Android Sdk MediaPlayer方法实现。遗憾的是App已停止

时间:2014-04-16 16:56:47

标签: android nullpointerexception runtime-error android-mediaplayer

04-16 16:26:25.238: D/dalvikvm(619): GC_FOR_ALLOC freed 56K, 5% free 2847K/2976K, paused 39ms, total 42ms
04-16 16:26:25.248: I/dalvikvm-heap(619): Grow heap (frag case) to 3.319MB for 495952-byte allocation
04-16 16:26:25.318: D/dalvikvm(619): GC_FOR_ALLOC freed 3K, 4% free 3328K/3464K, paused 26ms, total 26ms
04-16 16:26:25.408: E/MediaPlayer(619): error (1, -2147483648)
04-16 16:26:25.418: D/MediaPlayer(619): create failed:
04-16 16:26:25.418: D/MediaPlayer(619): java.io.IOException: Prepare failed.: status=0x1
04-16 16:26:25.418: D/MediaPlayer(619):     at android.media.MediaPlayer.prepare(Native Method)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.media.MediaPlayer.create(MediaPlayer.java:850)
04-16 16:26:25.418: D/MediaPlayer(619):     at com.example.buttona.Splash.onCreate(Splash.java:23)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.os.Looper.loop(Looper.java:136)
04-16 16:26:25.418: D/MediaPlayer(619):     at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:26:25.418: D/MediaPlayer(619):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:26:25.418: D/MediaPlayer(619):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:26:25.418: D/MediaPlayer(619):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:26:25.418: D/MediaPlayer(619):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:26:25.418: D/MediaPlayer(619):     at dalvik.system.NativeStart.main(Native Method)
04-16 16:26:25.428: D/AndroidRuntime(619): Shutting down VM
04-16 16:26:25.428: W/dalvikvm(619): threadid=1: thread exiting with uncaught exception (group=0xb2a8cd58)
04-16 16:26:25.438: E/AndroidRuntime(619): FATAL EXCEPTION: main
04-16 16:26:25.438: E/AndroidRuntime(619): Process: com.example.buttona, PID: 619
04-16 16:26:25.438: E/AndroidRuntime(619): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.buttona/com.example.buttona.Splash}: java.lang.NullPointerException
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.os.Looper.loop(Looper.java:136)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:26:25.438: E/AndroidRuntime(619):  at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:26:25.438: E/AndroidRuntime(619):  at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:26:25.438: E/AndroidRuntime(619):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:26:25.438: E/AndroidRuntime(619):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:26:25.438: E/AndroidRuntime(619):  at dalvik.system.NativeStart.main(Native Method)
04-16 16:26:25.438: E/AndroidRuntime(619): Caused by: java.lang.NullPointerException
04-16 16:26:25.438: E/AndroidRuntime(619):  at com.example.buttona.Splash.onCreate(Splash.java:24)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:26:25.438: E/AndroidRuntime(619):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:26:25.438: E/AndroidRuntime(619):  ... 11 more
04-16 16:26:29.768: I/Process(619): Sending signal. PID: 619 SIG: 9
04-16 16:29:50.508: D/dalvikvm(669): GC_FOR_ALLOC freed 60K, 5% free 2847K/2980K, paused 110ms, total 113ms
04-16 16:29:50.508: I/dalvikvm-heap(669): Grow heap (frag case) to 3.319MB for 495952-byte allocation
04-16 16:29:50.578: D/dalvikvm(669): GC_FOR_ALLOC freed 3K, 5% free 3328K/3468K, paused 26ms, total 26ms
04-16 16:29:50.668: E/MediaPlayer(669): error (1, -2147483648)
04-16 16:29:50.678: D/MediaPlayer(669): create failed:
04-16 16:29:50.678: D/MediaPlayer(669): java.io.IOException: Prepare failed.: status=0x1
04-16 16:29:50.678: D/MediaPlayer(669):     at android.media.MediaPlayer.prepare(Native Method)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.media.MediaPlayer.create(MediaPlayer.java:850)
04-16 16:29:50.678: D/MediaPlayer(669):     at com.example.buttona.Splash.onCreate(Splash.java:23)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.os.Looper.loop(Looper.java:136)
04-16 16:29:50.678: D/MediaPlayer(669):     at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:29:50.678: D/MediaPlayer(669):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:29:50.678: D/MediaPlayer(669):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:29:50.678: D/MediaPlayer(669):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:29:50.678: D/MediaPlayer(669):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:29:50.678: D/MediaPlayer(669):     at dalvik.system.NativeStart.main(Native Method)
04-16 16:29:50.688: D/AndroidRuntime(669): Shutting down VM
04-16 16:29:50.688: W/dalvikvm(669): threadid=1: thread exiting with uncaught exception (group=0xb2a8cd58)
04-16 16:29:50.698: E/AndroidRuntime(669): FATAL EXCEPTION: main
04-16 16:29:50.698: E/AndroidRuntime(669): Process: com.example.buttona, PID: 669
04-16 16:29:50.698: E/AndroidRuntime(669): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.buttona/com.example.buttona.Splash}: java.lang.NullPointerException
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.os.Looper.loop(Looper.java:136)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:29:50.698: E/AndroidRuntime(669):  at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:29:50.698: E/AndroidRuntime(669):  at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:29:50.698: E/AndroidRuntime(669):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:29:50.698: E/AndroidRuntime(669):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:29:50.698: E/AndroidRuntime(669):  at dalvik.system.NativeStart.main(Native Method)
04-16 16:29:50.698: E/AndroidRuntime(669): Caused by: java.lang.NullPointerException
04-16 16:29:50.698: E/AndroidRuntime(669):  at com.example.buttona.Splash.onCreate(Splash.java:24)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:29:50.698: E/AndroidRuntime(669):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:29:50.698: E/AndroidRuntime(669):  ... 11 more
04-16 16:29:53.048: I/Process(669): Sending signal. PID: 669 SIG: 9
04-16 16:36:21.928: D/dalvikvm(715): GC_FOR_ALLOC freed 64K, 5% free 2847K/2984K, paused 43ms, total 46ms
04-16 16:36:21.928: I/dalvikvm-heap(715): Grow heap (frag case) to 3.319MB for 495952-byte allocation
04-16 16:36:22.008: D/dalvikvm(715): GC_FOR_ALLOC freed 2K, 5% free 3328K/3472K, paused 29ms, total 29ms
04-16 16:36:22.118: E/MediaPlayer(715): error (1, -2147483648)
04-16 16:36:22.128: D/MediaPlayer(715): create failed:
04-16 16:36:22.128: D/MediaPlayer(715): java.io.IOException: Prepare failed.: status=0x1
04-16 16:36:22.128: D/MediaPlayer(715):     at android.media.MediaPlayer.prepare(Native Method)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.media.MediaPlayer.create(MediaPlayer.java:850)
04-16 16:36:22.128: D/MediaPlayer(715):     at com.example.buttona.Splash.onCreate(Splash.java:23)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.os.Looper.loop(Looper.java:136)
04-16 16:36:22.128: D/MediaPlayer(715):     at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:36:22.128: D/MediaPlayer(715):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:36:22.128: D/MediaPlayer(715):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:36:22.128: D/MediaPlayer(715):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:36:22.128: D/MediaPlayer(715):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:36:22.128: D/MediaPlayer(715):     at dalvik.system.NativeStart.main(Native Method)
04-16 16:36:22.138: D/AndroidRuntime(715): Shutting down VM
04-16 16:36:22.138: W/dalvikvm(715): threadid=1: thread exiting with uncaught exception (group=0xb2a8cd58)
04-16 16:36:22.138: E/AndroidRuntime(715): FATAL EXCEPTION: main
04-16 16:36:22.138: E/AndroidRuntime(715): Process: com.example.buttona, PID: 715
04-16 16:36:22.138: E/AndroidRuntime(715): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.buttona/com.example.buttona.Splash}: java.lang.NullPointerException
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.os.Looper.loop(Looper.java:136)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:36:22.138: E/AndroidRuntime(715):  at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:36:22.138: E/AndroidRuntime(715):  at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:36:22.138: E/AndroidRuntime(715):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:36:22.138: E/AndroidRuntime(715):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:36:22.138: E/AndroidRuntime(715):  at dalvik.system.NativeStart.main(Native Method)
04-16 16:36:22.138: E/AndroidRuntime(715): Caused by: java.lang.NullPointerException
04-16 16:36:22.138: E/AndroidRuntime(715):  at com.example.buttona.Splash.onCreate(Splash.java:24)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:36:22.138: E/AndroidRuntime(715):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:36:22.138: E/AndroidRuntime(715):  ... 11 more
04-16 16:36:25.658: I/Process(715): Sending signal. PID: 715 SIG: 9
04-16 16:41:32.168: D/dalvikvm(761): GC_FOR_ALLOC freed 68K, 5% free 2847K/2988K, paused 40ms, total 43ms
04-16 16:41:32.178: I/dalvikvm-heap(761): Grow heap (frag case) to 3.319MB for 495952-byte allocation
04-16 16:41:32.418: D/dalvikvm(761): GC_FOR_ALLOC freed 3K, 5% free 3328K/3476K, paused 46ms, total 46ms
04-16 16:41:32.528: E/MediaPlayer(761): error (1, -2147483648)
04-16 16:41:32.538: D/MediaPlayer(761): create failed:
04-16 16:41:32.538: D/MediaPlayer(761): java.io.IOException: Prepare failed.: status=0x1
04-16 16:41:32.538: D/MediaPlayer(761):     at android.media.MediaPlayer.prepare(Native Method)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.media.MediaPlayer.create(MediaPlayer.java:850)
04-16 16:41:32.538: D/MediaPlayer(761):     at com.example.buttona.Splash.onCreate(Splash.java:23)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.os.Looper.loop(Looper.java:136)
04-16 16:41:32.538: D/MediaPlayer(761):     at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:41:32.538: D/MediaPlayer(761):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:41:32.538: D/MediaPlayer(761):     at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:41:32.538: D/MediaPlayer(761):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:41:32.538: D/MediaPlayer(761):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:41:32.538: D/MediaPlayer(761):     at dalvik.system.NativeStart.main(Native Method)
04-16 16:41:32.548: D/AndroidRuntime(761): Shutting down VM
04-16 16:41:32.548: W/dalvikvm(761): threadid=1: thread exiting with uncaught exception (group=0xb2a8cd58)
04-16 16:41:32.558: E/AndroidRuntime(761): FATAL EXCEPTION: main
04-16 16:41:32.558: E/AndroidRuntime(761): Process: com.example.buttona, PID: 761
04-16 16:41:32.558: E/AndroidRuntime(761): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.buttona/com.example.buttona.Splash}: java.lang.NullPointerException
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread.access$800(ActivityThread.java:138)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.os.Handler.dispatchMessage(Handler.java:102)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.os.Looper.loop(Looper.java:136)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread.main(ActivityThread.java:5042)
04-16 16:41:32.558: E/AndroidRuntime(761):  at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:41:32.558: E/AndroidRuntime(761):  at java.lang.reflect.Method.invoke(Method.java:515)
04-16 16:41:32.558: E/AndroidRuntime(761):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:776)
04-16 16:41:32.558: E/AndroidRuntime(761):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-16 16:41:32.558: E/AndroidRuntime(761):  at dalvik.system.NativeStart.main(Native Method)
04-16 16:41:32.558: E/AndroidRuntime(761): Caused by: java.lang.NullPointerException
04-16 16:41:32.558: E/AndroidRuntime(761):  at com.example.buttona.Splash.onCreate(Splash.java:24)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.Activity.performCreate(Activity.java:5231)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-16 16:41:32.558: E/AndroidRuntime(761):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2172)
04-16 16:41:32.558: E/AndroidRuntime(761):  ... 11 more
04-16 16:41:34.618: I/Process(761): Sending signal. PID: 761 SIG: 9

这是Java文件。

package com.example.buttona;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;

public class Splash extends Activity {

MediaPlayer song = null;

@Override
protected void onCreate(Bundle splashExamleMethod) {
    // TODO Auto-generated method stub


    super.onCreate(splashExamleMethod);



    setContentView(R.layout.buttbcgrnd);

    song = MediaPlayer.create(Splash.this, R.raw.musica);
    song.start();


    Thread timer = new Thread() {
        public void run() {
            try{
                sleep(5000);

            } catch (InterruptedException e) {

                e.printStackTrace();

            }finally{

Intent openButtonwa = new   Intent("com.example.buttona.BUTTONWA");
                startActivity(openButtonwa);

            }
        }
    };
    timer.start();

}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    song.release();

    finish();
}



}

我删除MediaPlayer Method.My App RUns Fine。

的代码

我试图播放的mp3是1.37mb并且是正确的。

除了添加歌曲部分外,一切运行正常,但只要我添加歌曲及其代码,它就说不幸的是我的应用程序已经停止。

1 个答案:

答案 0 :(得分:0)

正如您从logcat中看到的,MediaPlayer.create已失败,因此返回值为null。

检查文件musica是否已损坏