......
private TimeCount time;
......
/* 定义一个倒计时的内部类 */
class TimeCount extends CountDownTimer {public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);// 参数依次为总时长,和计时的时间间隔
}
@Override
public void onFinish() {// 计时完毕时触发
textResendBtn.setText(resendVertifyCodeText);
textResendBtn.setClickable(true);
}
@Override
public void onTick(long millisUntilFinished) {// 计时过程显示
textResendBtn.setClickable(false);
textResendBtn.setText(millisUntilFinished / 1000 + "秒");
}
}
......
time.start();
......