I use the handler.postDelayed method to create some delay for some animated materials.
With this, I play some kind of song using Mediaplayer. The user can exit this action class by clicking next. But on the next screen, the same song continues, although I called the stop method in the next onclicklistener button.
This is due to the addition of timedelay, which starts after loading the next action. Any idea?
handler.postDelayed(new Runnable() {
public void run() {
mp = MediaPlayer.create(getApplicationContext(), R.raw.num2);
mp.start();
imageView1.setImageResource(R.drawable.countcat2);
}
}, 2000);
nasaa source
share