简体   繁体   English

恢复Android Activity播放媒体

[英]Restoring Android Activity playing media

I'm working on a project that includes a media player. 我正在一个包含媒体播放器的项目中。 All is going fine, I select the media to be played from a play list and send it to the player activity and press play. 一切顺利,我从播放列表中选择要播放的媒体,并将其发送到播放器活动,然后按播放。 The audio plays just like it should. 音频将按应有的方式播放。 Now, when I leave that activity (with the audio still playing) I'm unable to get back to that same activity, clicking the same item from the playlist starts a new activity with the old media playing in the background still. 现在,当我离开该活动(仍在播放音频)时,我无法回到同一活动,单击播放列表中的同一项目将启动一个新活动,而旧媒体仍在后台播放。 How can bring back an old activity? 如何恢复过去的活动?

I don't get your question at all. 我完全没有你的问题。 However, look at the state diagram here: 但是,在这里查看状态图:

http://developer.android.com/reference/android/media/MediaPlayer.html http://developer.android.com/reference/android/media/MediaPlayer.html

And the other state diagram here: 还有另一个状态图:

http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

Combine the MediaPlayer states and the Activity states in order to fulfill your need. 组合MediaPlayer状态和Activity状态,以满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM