2019年2月11日星期一

CountDownTimer(计时器)

try {
    if (cdt != null)
        cdt.cancel();} catch (Exception e) {
}
cdt = null;completedProbar.setProgress(0);
cdt = new CountDownTimer(30000, 1000) {
    int cc = 1;
    @Override    public void onTick(long millisUntilFinished) {
        
        cc++;    }

    @Override    public void onFinish() {
           }
}.start();

30秒每1秒进来一次onTick,完成后调用onFinish

没有评论:

发表评论