开发者

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜