我真的希望你能在这里帮助我。下面是我的代码的一部分,它成功并排运行了两个倒计时计时器……我想做的就是在倒计时完成后播放一个简短的 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