在Android的播放BG音乐在整个活动 [英] Playing BG Music Across Activities in Android

查看:177
本文介绍了在Android的播放BG音乐在整个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我们正在开发一个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.

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

<一个href="http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion">http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion

这篇关于在Android的播放BG音乐在整个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆