Reputation: 1972
I am using MediaPlayer to play some sound in my app, I want this playback to stop when user leaves activity in which sound is being played. So I did this by calling mediaplayer.stop() in my activities onStop() method.
public void onStop() {
super.onDestroy();
mediaPlayer.stop();
mediaPlayer.reset();
}
but now when device rotation changes even then sound playback stops,because onStop() method is called, which I don't want, playback should continue when device orientation changes. How can this be done.
Upvotes: 0
Views: 897
Reputation: 2671
Just add this ligne to your Manifest.xml
inside the <Activity>
you are focusing with that trouble :
android:configChanges="keyboardHidden|orientation|screenSize"
Upvotes: 0