I want to set a autoplay sound and it only play once, no matter the rotation is. I was trying to make my Mediaplayer in the onCreate of Mainactivity. And when I try to rotate the screen, the audio continued to play.
I try a different method like set up a subclass and call in the activity instead of puting it in onCreat of MainActivity to make it only play once and ignore doing rotate, but it still doesn’t work, can someone explain to me how can I fix it? Thank you!
2
Answers
You should clerify your case with code, but seams that it should help
You should use onConfigurationChanged to make this work.
in your manifest file add this to your activiy
In your MainActiviy code implement this method: