Hi all,
I am working on a new game and am trying to add some background music. I
want this music to play across several activities, so I created a separate
class to handle it. The music is a single 32 second mp3 file.
In my class, I get the music ready in the onCreate() like this:
mPlayer = MediaPlayer.create(this, R.raw.gametheme);
I then have two methods to start and stop the music:
**
* public static void play() {*
*
if(mSound == true)
{
soundPlaying = true;
mPlayer.setLooping(true);
mPlayer.setVolume(1.0f, 1.0f);
mPlayer.start();
}
}
public static void stop() {
if (soundPlaying == true)
{
mPlayer.stop();
}
}
*
However, when I call BackSound.play() the music doesn't play. (BackSound is
the name of the class). There is no exception or error. It just doesn't
play.
Any idea on how to do this?
Thanks
--
Raghav Sood
http://www.androidactivist.org/ - Author
http://www.appaholics.in/ - Founder
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en