I’m building an application which players sound using the Media Player class.
If I use the back button to go to the menu and then reopen the app the music is still playing but if I play another track, the app seems to create a new media player. I can’t put a reference saved instance state because it isn’t serializble.
What’s the recommended technique for keeping the reference?
Regards.
I would recommend you place your MediaPlayer behind a Service. I’ve found that a really good example of how to do this, as well as bind to that service and play media, is the NPR Radio app which is open source. You can find the source here