Skip to content

Instantly share code, notes, and snippets.

@pbrewczynski
Created June 16, 2013 08:16
Show Gist options
  • Save pbrewczynski/5791357 to your computer and use it in GitHub Desktop.
Save pbrewczynski/5791357 to your computer and use it in GitHub Desktop.
private void playDing(int howManyTimes) {
if(howManyTimes >0){
MediaPlayer mPlayer = MediaPlayer.create(this, R.raw.dingshort);
mPlayer.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
playDing(howManyTimes-1); //But java don't support closures
}
});
mPlayer.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment