Back to project page Space.Sprint.
The source code is released under:
GNU General Public License
If you think the Android project Space.Sprint listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.obisapps.spacerun; /*ww w . j a v a2s .c o m*/ import java.util.Random; import android.content.Context; import android.media.MediaPlayer; public class SoundManager { private Context context; MediaPlayer musicMPlayer; MediaPlayer jumpMPlayer; Random musicChoose = new Random(); public SoundManager(Context aContext) { context = aContext; } public void init() { musicMPlayer = MediaPlayer.create(context, R.raw.calm); musicMPlayer.setLooping(true); jumpMPlayer = MediaPlayer.create(context, R.raw.jump); } public void jumpSound() { jumpMPlayer.start(); } public void playMusic() { musicMPlayer.start(); } public void stopMusic() { musicMPlayer.stop(); } }