DingleNutZ
DingleNutZ

Reputation: 163

Stop Media Player After starting new intent

Here's my problem: I start a media player, and if I start a new intent, or leave the app and go back to it..

mp.stop;

..wont work (mp is my media player variable).

is there anyway to fix this?

Bonus to whoever can tell me how to link it up to a widget.

Upvotes: 0

Views: 859

Answers (1)

inazaruk
inazaruk

Reputation: 74790

You always must call mp.release() in your Activity's onDestroy(). It is also recommended to at least call mp.pause() in on onPause() Activity's method.

If you want playback to continue outside of Activity lifecycle (after onPause()/onStop()/onDestroy()) you have to create Service and play audio content from there.

Upvotes: 2

Related Questions