lundi 26 janvier 2015

playing sound after it reaches the whole duration of sound in mediaplayer android eclipse

i am new in android programming. What I am trying to do is to play the sound after it reaches the whole duration of the first inputted sounds but it seems like the sounds are stopping when my sounds should play up to 4 seconds.


my concept is:


if sound reaches to 1 second


mp.start


else if sound reaches to 2 seconds


mp.start


else if sound reaches to 3 seconds


mp.start


else if sound reaches to 4 seconds


mp.start


is there any code on how to do this?


because what i did is like this but it's not working



int x = mp.getDuration();
if(x >= 1000){
mp.start();
}else if(x >= 2000){
mp.start();
}
else if(x >= 3000){
mp.start();
}
else if(x >= 4000){
mp.start();
}

Aucun commentaire:

Enregistrer un commentaire