I\'m currently developing the android application ServeStream and I\'ve encountered and problem that I can\'t fix. My application will stream music and video using the android M
Do you want the activity not to be shown when you return? if yes you can simply use flag
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
If you want your media to be played in background I suggest you to use video surface as it has been irritating me playing in background though I dont want. There are ways but I hope this one will be fruitful for you http://www.brightec.co.uk/blog/custom-android-media-controller
this link actually is for customizing media controllers as you wish but as I created mine with it, I was bothered as pressing home key, the video would be played in background.