title: Resources$NotFoundException: Resource ID #0x0 Error Android
body: <p>Could you please tell me why am I getting this error? What I did wrong?</p>
  
  <pre><code>int[] songPos = {R.raw.position1,R.raw.position2,R.raw.position3,R.raw.position4};
      UnitPackage=getApplicationContext().getPackageName();
  
      list.setOnItemClickListener(new OnItemClickListener() {
  
                 @Override
                 public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                     int resId = getResources().getIdentifier("raw/"+songPos[position], null, UnitPackage);
                     MediaPlayer mp = MediaPlayer.create(CentralActivity.this, resId);  
  
                     if (mp.isPlaying()) {
                          mp.pause();
                      } else {
                          mp.start();
                      }
                 }
                 });
  
      07-11 10:06:26.051: W/ResourceType(21457): No package identifier when getting value for resource number 0x00000000
      07-11 10:06:26.051: D/AndroidRuntime(21457): Shutting down VM
      07-11 10:06:26.051: W/dalvikvm(21457): threadid=1: thread exiting with uncaught exception (group=0x418268b0)
      07-11 10:06:26.071: E/AndroidRuntime(21457): FATAL EXCEPTION: main
      07-11 10:06:26.071: E/AndroidRuntime(21457): android.content.res.Resources$NotFoundException: Resource ID #0x0
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.content.res.Resources.getValue(Resources.java:1125)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.content.res.Resources.openRawResourceFd(Resources.java:1083)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.media.MediaPlayer.create(MediaPlayer.java:837)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at goldenRing.rootapp.com.CentralActivity$1.onItemClick(CentralActivity.java:75)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.widget.AbsListView.performItemClick(AbsListView.java:1104)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2792)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.widget.AbsListView$1.run(AbsListView.java:3468)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.os.Handler.handleCallback(Handler.java:730)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.os.Handler.dispatchMessage(Handler.java:92)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.os.Looper.loop(Looper.java:213)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at android.app.ActivityThread.main(ActivityThread.java:5225)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at java.lang.reflect.Method.invokeNative(Native Method)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at java.lang.reflect.Method.invoke(Method.java:525)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
      07-11 10:06:26.071: E/AndroidRuntime(21457):    at dalvik.system.NativeStart.main(Native Metho
  
  d)
  </code></pre>
  
  <p>What am I doing wrong here? Am I missing something or? Do I need to find another way for this or it can be solved?</p>