custom extention from Android SoundPool with setOnCompletionListener without the low-efficiency drawback of MediaPlayer.
SoundPoolPlayer mPlayer = SoundPoolPlayer.create(context, resId);
mPlayer.setOnCompletionListener(
new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) { //mp will be null here
Log.d("debug", "completed");
}
};
);
mPlayer.play()
mPlayer.pause();
mPlayer.stop();
mPlayer.resume();
mPlayer.isPlaying();