我MediaPlayer
在我的Activity
.
当我点击后退按钮时,我收到此错误:
09-20 19:44:16.540: E/MediaPlayer(1822): pause called in state 64
09-20 19:44:16.540: E/MediaPlayer(1822): error (-38, 0)
代码
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
if (mp!= null && mp.isPlaying()) {
mp.stop();
}
Intent intentstart = new Intent(X.this, Y.class);
intentstart.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intentstart);
}
return super.onKeyDown(keyCode, event);
}
如果我使用mp.pause()
,它工作正常。为什么?