안드로이드에서 10 초 후에 미디어 플레이어를 재생하고 싶습니다.10 초 후에 미디어 플레이어를 재생하고 싶습니다.
player = MediaPlayer.create (getApplicationContext(), R.raw.sleep); player.start();
안드로이드에서 10 초 후에 미디어 플레이어를 재생하고 싶습니다.10 초 후에 미디어 플레이어를 재생하고 싶습니다.
player = MediaPlayer.create (getApplicationContext(), R.raw.sleep); player.start();
또 다른 방법은 핸들러
Handler h = new Handler();
h.postDelayed(new Runnable() {
public void run(){
player.start();
}
}, 10 * 1000);
함께
아래 뭔가를 시도 할 수 있습니다 : 트릭은 함께 할 때 CountDownTimer
player = MediaPlayer.create(getApplicationContext(), R.raw.beepsound);
CountDownTimer timer = new CountDownTimer(10000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
player.start();
}
};
timer.start();
가 & 플레이어를 해제 중지하는 것을 잊지 마세요 사용하여 10 초 후에 플레이어를 시작하는 것입니다.