dogIntroSound = MediaPlayer.create(AnimalPiker1.this, R.raw.introdog);
dogIntroSound.start();
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
} catch (InterruptedException e){
e.printStackTrace();
}finally{
dogSound = MediaPlayer.create(AnimalPiker1.this, R.raw.dog);
dogSound.start();
}
}
};
timer.start();
我尝试了很多东西,但这是最新的,但这甚至无效
答案 0 :(得分:1)
使用setOnCompletionListener:
dogIntroSound = MediaPlayer.create(AnimalPiker1.this, R.raw.introdog);
dogIntroSound.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
dogSound = MediaPlayer.create(AnimalPiker1.this, R.raw.dog);
dogSound.start();
}
});
dogIntroSound.start();