android倒计时器完成了

时间:2016-03-16 10:36:22

标签: android count

在我的活动中,我想检查countdowntimer是否已完成,我将停止活动并转到另一项活动?我该怎么做? 我像这样定义了倒计时器

mcountdowntimer = new CountDownTimer(25000,1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                Log.v("Log_tag", "Tick of Progress" + i + millisUntilFinished);
                i++;
                mProgressBar.setProgress(i);

            }

            @Override
            public void onFinish() {


                i++;
                mProgressBar.setProgress(i);

            }


        };
        mcountdowntimer.start();
        mProgressBar.setProgressTintList(ColorStateList.valueOf(Color.rgb(64,91,164)));

    }

1 个答案:

答案 0 :(得分:0)

只需在onFinish()方法中添加该逻辑:

@Override
public void onFinish() {
     //here add the code for starting a new activity
}