当 MediaPlayer 准备启动时,我想回到“activity main”,但我的应用程序崩溃了。我尝试此代码,但无法正常工作:s
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if ((keyCode == KeyEvent.KEYCODE_BACK))
{
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
seekHandler.removeCallbacks(run, null);
}
}
return super.onKeyDown(keyCode, event);
}