My music app dies after 7 songs are played
<p>i have created an app with 16 btns,every btn plays a sound mp3.my app starts with no problem.i press and listen one mp3,two mp3...until 7 mp3...there my app forces down.i can play any mp3 i like but i can only play the 7 mp3 i click first,where is my error?</p>

<pre><code>Button button = (Button) findViewById(R.id.btn);  
button.setOnClickListener(new View.OnClickListener() {  
    public void onClick(View v){
        MediaPlayer mp = MediaPlayer.create(ClickAndPlayMusic.this, R.raw.gata);  
        mp.start();
        Toast.makeText(ClickAndPlayMusic.this, "Cat", Toast.LENGTH_SHORT).show();

    }      

});      

        Button button2 = (Button) findViewById(R.id.btn2);  
        button2.setOnClickListener(new View.OnClickListener() {  
           public void onClick(View v){

               MediaPlayer mp = MediaPlayer.create(ClickAndPlayMusic.this, R.raw.lion);  
            mp.start();                    

               Toast.makeText(ClickAndPlayMusic.this, "Lion", Toast.LENGTH_SHORT).show();
           }

        });      
</code></pre>

<p>this is the way i have created every music btn...thanks!(hope my answer is understandable)</p>

<p>ps:this is my logcat view when it forces down:</p>

<pre><code>01-12 17:59:39.445: WARN/dalvikvm(16090): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090): FATAL EXCEPTION: main
01-12 17:59:39.449: ERROR/AndroidRuntime(16090): java.lang.NullPointerException
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at com.example.ClickAndPlayMusic.ClickAndPlayMusic$1.onClick(ClickAndPlayMusic.java:33)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.view.View.performClick(View.java:2461)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.view.View$PerformClick.run(View.java:8888)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.os.Handler.handleCallback(Handler.java:587)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.os.Looper.loop(Looper.java:123)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at android.app.ActivityThread.main(ActivityThread.java:4627)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at java.lang.reflect.Method.invokeNative(Native Method)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at java.lang.reflect.Method.invoke(Method.java:521)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-12 17:59:39.449: ERROR/AndroidRuntime(16090):     at dalvik.system.NativeStart.main(Native Method)
01-12 17:59:39.457: WARN/ActivityManager(2796):   Force finishing activity com.example.ClickAndPlayMusic/.ClickAndPlayMusic
01-12 17:59:39.461: INFO/(2796): dumpmesg &gt; "/data/log/dumpstate_app_error.log"
</code></pre>

<p>33 line is the mp.start(); in the onClick method of the first btn!</p>

<p>second logcatview:</p>

<pre><code>01-12 19:37:39.000: ERROR/PlayerDriver(2584): Command PLAYER_SET_DATA_SOURCE completed with an error or info -4
01-12 19:37:39.000: ERROR/MediaPlayer(20357): error (-4, -4)
01-12 19:37:39.000: ERROR/TAGNAME(20357): Prepare failed.: status=0xFFFFFFFC
01-12 19:37:39.000: WARN/System.err(20357): java.io.IOException: Prepare failed.:      status=0xFFFFFFFC
01-12 19:37:39.000: WARN/System.err(20357):     at    android.media.MediaPlayer.prepare(Native Method)
01-12 19:37:39.000: WARN/System.err(20357):     at com.example.ClickAndPlayMusic.ClickAndPlayMusic.playMedia(ClickAndPlayMusic.java:242)
01-12 19:37:39.000: WARN/System.err(20357):     at com.example.ClickAndPlayMusic.ClickAndPlayMusic.access$0(ClickAndPlayMusic.java:237)
01-12 19:37:39.000: WARN/System.err(20357):     at com.example.ClickAndPlayMusic.ClickAndPlayMusic$13.onClick(ClickAndPlayMusic.java:191)
01-12 19:37:39.000: WARN/System.err(20357):     at android.view.View.performClick(View.java:2461)
01-12 19:37:39.000: WARN/System.err(20357):     at   android.view.View$PerformClick.run(View.java:8888)
01-12 19:37:39.000: WARN/System.err(20357):     at android.os.Handler.handleCallback(Handler.java:587)
01-12 19:37:39.000: WARN/System.err(20357):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-12 19:37:39.000: WARN/System.err(20357):     at android.os.Looper.loop(Looper.java:123)
01-12 19:37:39.000: WARN/System.err(20357):     at   android.app.ActivityThread.main(ActivityThread.java:4627)
01-12 19:37:39.000: WARN/System.err(20357):     at java.lang.reflect.Method.invokeNative(Native Method)
01-12 19:37:39.000: WARN/System.err(20357):     at java.lang.reflect.Method.invoke(Method.java:521)
01-12 19:37:39.000: WARN/System.err(20357):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-12 19:37:39.000: WARN/System.err(20357):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-12 19:37:39.000: WARN/System.err(20357):     at dalvik.system.NativeStart.main(Native Method)
01-12 19:37:39.008: INFO/MediaPlayer(20357): Info (1,26)
01-12 19:37:39.008: ERROR/MediaPlayer(20357): Error (-4,-4)
</code></pre>
