ホームボタンまたは戻るボタンをクリックしても、オーディオ/サウンドはまだ実行されていますが、オーディオのソースはswf(flash)ですが、どうすれば修正できますか?
2 に答える
1
または でプレーヤーを一時停止して解放し、onPause
またはonStop
で初期化するonStart
必要がありonResume
ます。Android デベロッパー サイトには、これに関するトレーニングがあります。このコードをアクティビティに追加する必要があります
@Override
public void onPause() {
super.onPause(); // Always call the superclass method first
// Release the mPlayer because we don't need it when paused
// and other activities might need to use it.
// You change this part to your implement. Stop your player
if (mPlayer != null) {
mPlayer .release()
mPlayer = null;
}
//
}
で再度初期化onResume
@Override
public void onResume() {
super.onResume(); // Always call the superclass method first
// Get the mPlayer instance as the activity achieves full user focus
if (mPlayer == null) {
initializePlayer (); // Local method to handle mPlayer init
}
}
于 2012-09-29T14:04:26.107 に答える
1
onPause メソッドをオーバーライドし、そこでオーディオを停止する必要があります。
player.pause();
于 2012-09-29T14:00:47.217 に答える