On one activity there are several blocks (about 10) of the text and under each block a sound that is played when you click on Play.
Pressing the Play button starts playing the sound and changes the Play button to Pause. When playback ends, the Play button returns.
Problem:
If you still BEFORE completing the previous sound, click on the second playback, then the Pause button on the first sound does not change to Play. It just freezes, but the button itself works, the state of the button itself hangs.
Is there any way to track down the interruption of the sound and change the Pause button on Play when interrupted?
Code:
@Override public void onClick(View v) { switch (v.getId()) { case R.id.play1: if (!answerAboutPlay){ stopPlaying(); mp = MediaPlayer.create(summer.this, R.raw.summerplay1); mp.start(); answerAboutPlay = true; summerplay1.setBackgroundResource(R.drawable.pause_light); } else { mp.pause(); answerAboutPlay = false; summerplay1.setBackgroundResource(R.drawable.play_light); } mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { summerplay1.setBackgroundResource(R.drawable.play_light); answerAboutPlay = false; } });