private Timer timer;
timer.schedule(new TimerTask() { @Override public void run() { if (isStopedRecorderView) return;//取消而停止录音 if (time > 0) {
//子线程 coutndowHandler.post(new Runnable() { @Override public void run() {
//UI线程 startCountdownTip(time); } }); time--; LogHelp.i("voice", "time:" + time); } else if (time == 0) { timer.cancel();
//子线程 coutndowHandler.post(new Runnable() { @Override public void run() {
//UI线程 stopRecorderView(); } }); } } }, 0, 1000);
为了避免计时器重复,要及时关闭Timer
timer.cancel();