mediaPlayer.setOnCompletionListener(new OnCompletionListener(){
int count = 0; // initialize somewhere before, not sure if this will work here
int maxCount = 5;
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
if(count < maxCount) {
count++;
mediaPlayer.seekTo(0);
mediaPlayer.start();
}
}});
|
|