I ran into a problem in Android where it seems to me that I need to save a link to a MediaPlayer object.
In my Activity I start by creating an instance of the MediaPlayer object, and I can start playing the selected music. The problem is that the screen rotates, the activity is destroyed, it is created again, and then I lose the link to MediaPlayer (since I do not save it anywhere). A new object is created, and the next time the user interacts with the phone, the music stops playing. What is the right way to hold a pen? Should I be? It is not Serializable, so I cannot put it in onSaveInstanceState(Bundle) .
Thanks for the help.
source share