title: Setting custom adapter to Navigation Drawer
body: <p>I am trying to use my custom adapter with my Navigation Drawer but I don't know how to add it so it can use it.</p>
  
  <p>any guidance would be appreciated, thank. </p>
  
  <p>This is my custom Adapter:</p>
  
  <pre><code>private class SampleItem {
      public String tag;
      public int iconRes;
  
      public SampleItem(String tag, int iconRes) {
          this.tag = tag;
          this.iconRes = iconRes;
      }
  }
  
  public class SampleAdapter extends ArrayAdapter&lt;SampleItem&gt; {
  
      public SampleAdapter(Context context) {
          super(context, 0);
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          if (convertView == null) {
              convertView = LayoutInflater.from(getContext()).inflate(
                      R.layout.row, null);
          }
          ImageView icon = (ImageView) convertView
                  .findViewById(R.id.ImageNavDrawer);
          icon.setImageResource(getItem(position).iconRes);
          TextView title = (TextView) convertView
                  .findViewById(R.id.NavListTextview);
          title.setText(getItem(position).tag);
  
          return convertView;
      }
  
  }
  </code></pre>
  
  <p>How the drawer is set up:</p>
  
  <pre><code> @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      mDrawerListView = (ListView) inflater.inflate(
              R.layout.fragment_navigation_drawer, container, false);
      mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              selectItem(position);
          }
      });
      mDrawerListView.setAdapter(new ArrayAdapter&lt;String&gt;(
              getActionBar().getThemedContext(),
              R.layout.row,
              R.id.NavListTextview,
              new String[]{
                      getString(R.string.1),
                      getString(R.string.2),
                      getString(R.string.3),
              }));
      mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
      return mDrawerListView;
  }
  </code></pre>
  
  <p>How iv'e used the Adapter in other projects:</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      return inflater.inflate(R.layout.list, null);
  
  }
  
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      SampleAdapter adapter = new SampleAdapter(getActivity());
      {
  
          adapter.add(new SampleItem("Archietecture",
                  R.drawable.archietecture));
          adapter.add(new SampleItem("Art", R.drawable.art));
          adapter.add(new SampleItem("Cinema", R.drawable.cinema));
          adapter.add(new SampleItem("Discoveries", R.drawable.discoveries));
          adapter.add(new SampleItem("Events", R.drawable.events));
          adapter.add(new SampleItem("Literature", R.drawable.literature));
          adapter.add(new SampleItem("Music", R.drawable.music));
          adapter.add(new SampleItem("Nature", R.drawable.nature));
          adapter.add(new SampleItem("Politics", R.drawable.politics));
          adapter.add(new SampleItem("Science", R.drawable.science));
          adapter.add(new SampleItem("Sports", R.drawable.sports));
          adapter.add(new SampleItem("Technology", R.drawable.technology));
  
      }
      setListAdapter(adapter);
  }
  
  private class SampleItem {
      public String tag;
      public int iconRes;
  
      public SampleItem(String tag, int iconRes) {
          this.tag = tag;
          this.iconRes = iconRes;
      }
  }
  
  public class SampleAdapter extends ArrayAdapter&lt;SampleItem&gt; {
  
      public SampleAdapter(Context context) {
          super(context, 0);
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          if (convertView == null) {
              convertView = LayoutInflater.from(getContext()).inflate(
                      R.layout.row, null);
          }
          ImageView icon = (ImageView) convertView
                  .findViewById(R.id.row_icon);
          icon.setImageResource(getItem(position).iconRes);
          TextView title = (TextView) convertView
                  .findViewById(R.id.row_title);
          title.setText(getItem(position).tag);
  
          return convertView;
      }
  
  }
  </code></pre>