在Android的播放BG音乐在整个活动在整个、音乐、Android、BG

2023-09-12 00:16:45 作者:帘卷笙声寂

您好!第一次问一个问题在这里计算器。令人兴奋的!哈哈。的

我们正在开发一个Android游戏,我们玩一些背景音乐,为我们介绍(我们有前奏活动),但我们希望它继续发挥到下一个活动,或许能够停止或再次播放音乐任何地方的应用程序中。

We're developing an Android game and we play some background music for our intro (we have an Intro Activity) but we want it to continue playing to the next Activity, and perhaps be able to stop or play the music again from anywhere within the application.

我们正在做的那一刻是播放使用MediaPlayer的背景音乐,在我们的介绍活动。但是,我们的用户离开该活动一旦停止音乐。我们是否有使用类似服务吗?或者是MediaPlayer的/的Soundpool就够了吗?如果有人知道答案,我们会很高兴地AP preciate您与我们一起分享吧。谢谢!

What we're doing at the moment is play the bgm using MediaPlayer at our Intro Activity. However, we stop the music as soon as the user leaves that Activity. Do we have to use something like Services for this? Or is MediaPlayer/SoundPool enough? If anyone knows the answer, we'd gladly appreciate your sharing it with us. Thanks!

推荐答案

在我的经验,使用服务,这不是一个很好的主意。

In my experience using Services for this is not a very good idea.

背景音乐,而无需使用服务:

http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion