title: Android DrawerLayout and Listview with custom adapter
body: <p>I am creating a drawer layout with a relative layout and a listview inside (one for the main content and one for the navigation)</p>
  
  <p>For the listview i created a custom adapter and i create each row using a list_item xml file which has an imageview and a textview.</p>
  
  <p>The app runs but when i open the drawer i see only the background without the listview.
  Now if i try it with the ArrayAdapter (default) the listview shows up.</p>
  
  <p>Any advice?</p>
  
  <p>My custom adapter</p>
  
  <pre><code>public class CustomAdapter extends ArrayAdapter&lt;Categories&gt;{
  
  Context context;
  int layoutResourceId;
  Categories[] data = null;
  
  public CustomAdapter(Context context, int layoutResourceId, Categories[] categs) {
      super(context, layoutResourceId);
      this.layoutResourceId = layoutResourceId;
      this.context = context;
      data = categs;
  }
  
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      PHolder holder = null;
  
      if(row == null)
      {
          LayoutInflater inflater = ((Activity)context).getLayoutInflater();
          row = inflater.inflate(layoutResourceId, parent, false);
  
          holder = new PHolder();
          holder.imgIcon = (ImageView)row.findViewById(R.id.categimage);
          holder.txtTitle = (TextView)row.findViewById(R.id.categtext);
  
          row.setTag(holder);
      }
      else
      {
          holder = (PHolder)row.getTag();
      }
  
      Categories categ = data[position];
      holder.txtTitle.setText(categ.title);
      holder.imgIcon.setImageResource(categ.icon);
  
      return row;
  }
  
  static class PHolder
  {
      ImageView imgIcon;
      TextView txtTitle;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And in my main activity</p>
  
  <pre><code>mDrawerList = (ListView) findViewById(R.id.categlist);
  
      Categories data[] = new Categories[]
      {
          new Categories(R.drawable.restaurant, R.string.food),
          new Categories(R.drawable.bar_coktail, R.string.bar),
          new Categories(R.drawable.mall, R.string.shop),
          new Categories(R.drawable.agritourism, R.string.out),
          new Categories(R.drawable.dance_class, R.string.art),
          new Categories(R.drawable.officebuilding, R.string.other),
          new Categories(R.drawable.university, R.string.education),
          new Categories(R.drawable.townhouse, R.string.house),
          new Categories(R.drawable.junction, R.string.transport)
      };
      CustomAdapter ca = new CustomAdapter(this, R.layout.list_item, data);
  
      View header = (View)getLayoutInflater().inflate(R.layout.list_header, null);
      mDrawerList.addHeaderView(header);
  
      mDrawerList.setAdapter(ca);
  </code></pre>