I have a button – on press of that , i am playing a sound and moving to the next activity. The sound clip is of 4 secs. I want the sound to be fully played and THEN move to the next activity.
What is happening now is on click of the button the activity moves to the next and the sound is also played and it doesnt work as per my need.
My code
final ImageButton circleButton=(ImageButton)findViewById(R.id.circleCircle);
circleButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
/* Code for playing the "Very Good" sound */
MediaPlayer mediaPlayer = MediaPlayer.create(shapeActivity.this, R.raw.wow);
mediaPlayer.start();
Intent myintent1 = new Intent(shapeActivity.this,shapeSquareActivity.class);
myintent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(myintent1);
}});
Can someone help?
Use mediaplayer oncomplete listener method, once the sound is complete than move to next intent