countDownTimer = new CountDownTimer(15000, 1000) {
/**
* 当前任务每完成一次倒计时间隔时间时回调
* @param millisUntilFinished
*/
public void onTick(long millisUntilFinished) {
long ltime = millisUntilFinished / 1000;
ltime = 15 - ltime;
tvTimer.setText("00:" + ltime);
if (ltime <= 9) {
tvTimer.setText("00:" + "0" + ltime);
}
}
/**
* 倒计时完成后回调
*/
public void onFinish() {
endRecord();//停止录音
cancel();//关闭倒计时
}
}.start();
网友评论