0
我真的很希望你能幫助我。下面是我的代碼的一部分,並行成功地運行兩個倒計時定時器...我想要做的就是當倒計時結束時播放一個短的MP3文件....我已經嘗試了很多不同的代碼位,但我我在努力做什麼工作......一個快速取勝將是一件好事..倒計時播放鬧鐘
所以圍捕兩個定時器每個需要播放聲音完成後..提前
//Declare Start/Stop button
Button btnstart = (Button)findViewById(R.id.btnstart);
Button Button1 = (Button)findViewById(R.id.Button01);
final TextView mCounter1TextField=(TextView)findViewById(R.id.counter1);
final TextView mCounter2TextField=(TextView)findViewById(R.id.counter2);
//Counter 1
final CountDownTimer Counter1 = new CountDownTimer(9000000 , 1000) {
public void onTick(long millisUntilFinished) {
mCounter1TextField.setText(" " + formatTime(millisUntilFinished));
}
public void onFinish() {
start();
}
};
//Counter 2
final CountDownTimer counter2 = new CountDownTimer(9000000 , 1000) {
public void onTick(long millisUntilFinished) {
mCounter2TextField.setText(" " + formatTime(millisUntilFinished));
}
public void onFinish() {
start();
}
};
//Start Button1
btnstart.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Counter1.start();
}
});
//Start Button2
Button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
counter2.start();
感謝
Dj
開始的定義中()?可以擴大一點我很新的編碼:)謝謝 – Djorn 2012-02-12 12:35:28
我編輯和擴大我的答案很多給你:P閱讀它,如果你仍然不明白,我很樂意向你解釋更多,只是告訴我什麼你不明白 – Karim 2012-02-12 12:47:39
老兄非常感謝 – Djorn 2012-02-12 12:57:06