开发者

Stop Media Player After starting new intent

开发者 https://www.devze.com 2023-03-18 19:37 出处:网络
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..

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

精彩评论

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