我正在实现一个Android媒体播放器。它播放的次数很少,之后会停止播放。它给出的错误是:E/MediaPlayer: Error (1,-19)
。我尝试使用mp.release()
,但它会发出另类错误。我该如何解决这个???
07-07 14:37:11.160 20825-20825/com.example.dmacs.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.dmacs.myapplication, PID: 20825
java.lang.IllegalStateException
at android.media.MediaPlayer._stop(Native Method)
at android.media.MediaPlayer.stop(MediaPlayer.java:1200)
at com.example.dmacs.myapplication.second_main$1.onClick(second_main.java:184)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
07-07 14:38:17.162 21540-21540/com.example.dmacs.myapplication E/MediaPlayer: Should have subtitle controller already set
答案 0 :(得分:1)
if (two.isPlaying()) {
two.reset();
two = MediaPlayer.create(getApplicationContext(), R.raw.two);
}
two.start();