title: How do I investigate an issue with loading a bitmap using BitmapFactory in Android? "getEntry failing because entryIndex..."
body: <p>I'm trying to load a bitmap and display it on a canvas.  I've done it previously using this method and it's worked fine.  Unfortunately, something has gone wrong this time and I don't know how I can track down the problem.</p>
  
  <p>My code gets to here:</p>
  
  <pre><code>Log.d(TAG, "Loading bitmaps");
  this.stageL=BitmapFactory.decodeResource(getResources(), R.drawable.stagel);
  Log.d(TAG,"Bitmap loaded");
  int stageLHeight = stageL.getHeight();
  Log.d(TAG,String.valueOf(stageLHeight));
  </code></pre>
  
  <p>But then I get a warning in the logcat in-between <code>Loading bitmaps</code> and <code>Bitmap Loaded</code>.  After that the app force closes and I never see the value of <code>stageLHeight.</code></p>
  
  <p>Here's the logcat:</p>
  
  <pre><code>11-07 15:22:50.182: DEBUG/LabSetup(613): Loading bitmaps
  11-07 15:22:50.182: WARN/ResourceType(613): getEntry failing because entryIndex 3 is beyond type entryCount 1
  11-07 15:22:50.182: WARN/ResourceType(613): Failure getting entry for 0x7f020003 (t=1 e=3) in package 0 (error -2147483647)
  11-07 15:22:50.182: DEBUG/LabSetup(613): Bitmap loaded
  11-07 15:22:50.222: WARN/dalvikvm(613): threadid=9: thread exiting with uncaught exception (group=0x40014760)
  11-07 15:22:50.222: ERROR/AndroidRuntime(613): FATAL EXCEPTION: Thread-10
  11-07 15:22:50.222: ERROR/AndroidRuntime(613): java.lang.NullPointerException
  11-07 15:22:50.222: ERROR/AndroidRuntime(613):     at com.cjs.duallaseralignment.LabSetup.SetCanvasSize(LabSetup.java:53)
  11-07 15:22:50.222: ERROR/AndroidRuntime(613):     at com.cjs.duallaseralignment.MainAppPanel.onDraw(MainAppPanel.java:136)
  11-07 15:22:50.222: ERROR/AndroidRuntime(613):     at com.cjs.duallaseralignment.MainThread.run(MainThread.java:56)
  </code></pre>
  
  <p>And in case it's useful, the R.java:</p>
  
  <pre><code>public final class R {
      public static final class attr {
      }
      public static final class drawable {
          public static final int icon=0x7f020000;
          public static final int mag=0x7f020001;
          public static final int magr=0x7f020002;
          public static final int stagel=0x7f020003;
          public static final int stager=0x7f020004;
      }
      public static final class layout {
          public static final int main=0x7f030000;
      }
      public static final class string {
          public static final int app_name=0x7f040001;
          public static final int hello=0x7f040000;
      }
  }
  </code></pre>