title: Having trouble with adapters. android.content.res.Resources$NotFoundException: Resource ID #0x0
body: <p>So I'm having a bunch of trouble with adapters.  I'm not sure what is wrong.  The error I'm receiving is </p>
  
  <pre><code>06-2619:44:59.228:E/AndroidRuntime(7275):android.content.res.Resources$NotFoundException: Resource ID #0x0
  </code></pre>
  
  <p>Now I'm going to post all my code here.  There's quite a bit, So I'll point out where I believe the problem lies.  I just don't know how to fix it.  </p>
  
  <p>MainActivity.java</p>
  
  <pre><code>    public class MainActivity extends Activity {
      private DrawerLayout mDrawerLayout;
      private ListView mDrawerList;
      private ActionBarDrawerToggle mDrawerToggle;
  
      private CharSequence mDrawerTitle;
      private CharSequence mTitle;
      private String[] mPlanetTitles;
  
      Context mContext;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mTitle = mDrawerTitle = getTitle();
          mPlanetTitles = getResources().getStringArray(R.array.planets_array);
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          mDrawerList = (ListView) findViewById(R.id.left_drawer);
  
          // set a custom shadow that overlays the main content when the drawer opens
          mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);(PROBLEM LIES HERE)
  
          // We pass our newly generated list to the adapter
          ArrayList&lt;String&gt; tempTiles = new ArrayList&lt;String&gt;();
          for(int i = 0; i &lt; mPlanetTitles.length; i++ ){
              tempTiles.add(mPlanetTitles[i]); (PROBLEM LIES HERE)
  
          }
          SideMenuAdapter adapter = new SideMenuAdapter(this,   R.layout.drawer_list_item,  tempTiles);
  
          mDrawerList.setAdapter(adapter);
  
          // set up the drawer's list view with items and click listener
  //        mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this,
  //                R.layout.drawer_list_item, mPlanetTitles));
          mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
  
          // enable ActionBar app icon to behave as action to toggle nav drawer
          getActionBar().setDisplayHomeAsUpEnabled(true);
          getActionBar().setHomeButtonEnabled(true);
  
          // ActionBarDrawerToggle ties together the the proper interactions
          // between the sliding drawer and the action bar app icon
          mDrawerToggle = new ActionBarDrawerToggle(
                  this,                  /* host Activity */
                  mDrawerLayout,         /* DrawerLayout object */
                  R.drawable.ic_drawer,  /* nav drawer image to replace 'Up' caret */
                  R.string.drawer_open,  /* "open drawer" description for accessibility */
                  R.string.drawer_close  /* "close drawer" description for accessibility */
                  ) {
              public void onDrawerClosed(View view) {
                  getActionBar().setTitle(mTitle);
                  invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
              }
  
              public void onDrawerOpened(View drawerView) {
                  getActionBar().setTitle(mDrawerTitle);
                  invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
              }
          };
          mDrawerLayout.setDrawerListener(mDrawerToggle);
  
          if (savedInstanceState == null) {
              selectItem(0);
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.main, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      /* Called whenever we call invalidateOptionsMenu() */
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          // If the nav drawer is open, hide action items related to the content view
          boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
          menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
          return super.onPrepareOptionsMenu(menu);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
           // The action bar home/up action should open or close the drawer.
           // ActionBarDrawerToggle will take care of this.
          if (mDrawerToggle.onOptionsItemSelected(item)) {
              return true;
          }
          // Handle action buttons
          switch(item.getItemId()) {
          case R.id.action_websearch:
              // create intent to perform web search for this planet
              Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
              intent.putExtra(SearchManager.QUERY, getActionBar().getTitle());
              // catch event that there's no activity to handle intent
              if (intent.resolveActivity(getPackageManager()) != null) {
                  startActivity(intent);
              } else {
                  Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show();
              }
              return true;
          default:
              return super.onOptionsItemSelected(item);
          }
      }
  </code></pre>
  
  <p>SideMenuAdapter.java</p>
  
  <pre><code>package com.example.android.navigationdrawerexample;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  
  
  public class SideMenuAdapter  extends ArrayAdapter&lt;String&gt; {
      private Context context;
      private int rowViewResourceId;
      //private List&lt;SideMenuListItem&gt; sideMenuItemsList = new ArrayList&lt;SideMenuListItem&gt;();
  
      //private ImageView SideMenuItemIcon;
      private TextView sideMenuItemName;
      private List&lt;String&gt; objects;
      private int textViewResourceId;
  
  
      public SideMenuAdapter(Context context, int textViewResourceId, List&lt;String&gt; objects){
          super(context, textViewResourceId, objects);
          this.textViewResourceId = textViewResourceId;
          this.context = context;
          this.objects= objects;
  
      }
  
      public int getCount(){
          return this.objects.size();
      }
  
      public String getItem(int index) {
          return this.objects.get(index);
      }
  
      public View getView(int position, View convertView, ViewGroup parent){
  
          View row = convertView; (PROBLEM LIES HERE)
          if (row == null) {
              LayoutInflater inflater = (LayoutInflater) this.getContext()
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row = inflater.inflate(rowViewResourceId, parent,
                      false);
          }
  
          String sideMenuListItem = getItem(position);
  
          //thinking about making a boolean to say if it's a title then do this.
          if(position == 0){
              //set the text to the xml format
              sideMenuItemName = (TextView) row.findViewById(R.id.list_header_title);
              sideMenuItemName.setText(sideMenuListItem);
  
              //need to make the text gone so it doesn't take up space 
              //this lets us put the title where we want it
              TextView setT = (TextView) row.findViewById(R.id.text1);
              setT.setVisibility(View.GONE);
  
              //need to make row icon gone so it doesn't take up space 
              //this lets us put the icon where we want it
              //ImageView setTV = (ImageView) row.findViewById(R.id.row_icon);
              //setTV.setVisibility(View.GONE);
  
              //setting the color for the divider
              View divider= (View) row.findViewById(R.id.customdivider); 
              divider.setBackgroundColor(0xFFFF0000);
  
          }
          else{
              //lets find our items that we want the list to be populated
              sideMenuItemName = (TextView) row.findViewById(R.id.list_header_title);
  
  
              //need to make the title gone so it doesn't take up space 
              //this lets us put the title where we want it
              TextView setTV = (TextView) row.findViewById(R.id.list_header_title);
              setTV.setVisibility(View.GONE);
  
              //set the text
              sideMenuItemName.setText(sideMenuListItem);
  //
  //          int imageResource = context.getResources().getIdentifier(
  //                  slidingMenuListItem.IconResourceId, null,
  //                  context.getPackageName());
  //
  //          //set the image
  //          slidingMenuItemIcon.setImageResource(imageResource);
  
              //setting the color for the divider
              View divider= (View) row.findViewById(R.id.customdivider); 
              divider.setBackgroundColor(0xFFFFFF00);
          }
  
  
          return row;
      }
  
  
  
  }
  </code></pre>
  
  <p>XML files</p>
  
  <p>activity_main.xml
      
      
          
          
          
          
      </p>
  
  <p>drawer_list_item.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/text1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?android:attr/activatedBackgroundIndicator"
          android:gravity="center_vertical"
          android:minHeight="?android:attr/listPreferredItemHeightSmall"
          android:paddingLeft="16dp"
          android:paddingRight="16dp"
          android:textAppearance="?android:attr/textAppearanceListItemSmall"
          android:textColor="#fff" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:id="@+id/list_header_title"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:padding="10dp" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;View
          android:id="@+id/customdivider"
          android:layout_width="fill_parent"
          android:layout_height="1dp" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>fragment_planet.xml</p>
  
  <pre><code>&lt;ImageView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/image"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#000000"
      android:gravity="center"
      android:padding="32dp" /&gt;
  </code></pre>
  
  <p>Please help!  </p>