Android Open Source - AerisAndroidLibrary Nav Drawer List Adapter

From Project

Back to project page AerisAndroidLibrary.


The source code is released under:

Apache License

If you think the Android project AerisAndroidLibrary listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.menudrawer;
//  www  .j  a v a  2 s  . c  om
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.demoaerisproject.R;

public class NavDrawerListAdapter extends BaseAdapter {

  private Context context;
  private ArrayList<NavDrawerItem> navDrawerItems;

  public NavDrawerListAdapter(Context context,
      ArrayList<NavDrawerItem> navDrawerItems) {
    this.context = context;
    this.navDrawerItems = navDrawerItems;

  public int getCount() {
    return navDrawerItems.size();

  public Object getItem(int position) {
    return navDrawerItems.get(position);

  public long getItemId(int position) {
    return position;

  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      LayoutInflater mInflater = (LayoutInflater) context
      convertView = mInflater.inflate(R.layout.drawer_list_item, null);

    ImageView imgIcon = (ImageView) convertView.findViewById(;
    TextView txtTitle = (TextView) convertView.findViewById(;
    TextView txtCount = (TextView) convertView.findViewById(;

    if (navDrawerItems.get(position).getIcon() <= 0) {
    } else {

    // displaying count
    // check whether it set visible or not
    if (navDrawerItems.get(position).getCounterVisibility()) {
    } else {
      // hide the counter view

    return convertView;


Java Source Code List