This has got to be simple. I have a single button in my app. When you press the button it plays a sound that’s about 1 minute long. The problem is that if someone presses the button twice, three times, etc…the sounds will just build on each other. How do I prevent a second sound from being played. Here is the onClick code.
public void onClick(View v) {
final MediaPlayer mMediaPlayer=MediaPlayer.create(getBaseContext(), R.raw.ifightsong);
mMediaPlayer.reset();
mMediaPlayer.start();
}
MediaPlayer.isPlaying()
May be what you want.
You can check out MediaPlayer.isLooping() as well.