title: How to get Bitmap from android's default resource?
body: <p>Hi I am doing this using this way</p>
  
  <pre><code>Bitmap bm = BitmapFactory.decodeResource(getResources(), android.R.drawable.list_selector_background);
  
  int c = bm.getPixel(bm.getWidth()/2, bm.getHeight()/2);
  </code></pre>
  
  <p>but bm is <code>null</code> as gives <code>NullPointerException</code> at second line.</p>
  
  <p>Error:</p>
  
  <pre><code>02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.os.Handler.dispatchMessage(Handler.java:99)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.os.Looper.loop(Looper.java:137)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.ActivityThread.main(ActivityThread.java:4424)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at java.lang.reflect.Method.invokeNative(Native Method)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at java.lang.reflect.Method.invoke(Method.java:511)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at dalvik.system.NativeStart.main(Native Method)
  02-12 18:29:57.568: E/AndroidRuntime(5086): Caused by: java.lang.NullPointerException
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at com.example.showhide.MainActivity.onCreate(MainActivity.java:38)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.Activity.performCreate(Activity.java:4465)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  02-12 18:29:57.568: E/AndroidRuntime(5086):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  </code></pre>