I followed this tutorial to create an audio player.
Now I want to add some events that fires events when the player reaches a specific progress. For example, at 00:32 of the current audio, display a Toast.
The interface should look like this :
The white dots represents the events in this case. Any idea?
I found it guys, here is my code (that worked perfectly)
private ImageView CreateWhiteDot(int time) {
ImageView WhiteDot = new ImageView(getApplicationContext());
float x = 0;
float y = 0;
WhiteDot.setImageResource(R.drawable.stop_dot_inactive);
x = sbStopPlayerSlider.getX() + 15;
x += ((sbStopPlayerSlider.getWidth() - 30) * time * 1000)
/ mpAudioPlayer.getDuration();
WhiteDot.setX(x);
y = sbStopPlayerSlider.getTranslationY()
+ sbStopPlayerSlider.getHeight() / 2;
WhiteDot.setY(y);
return WhiteDot;
}