How to stop Android's CountDownTimer?

时间:2019-04-16 23:37:18

标签: java android countdowntimer

I have set up an anonymous class that contains an implementation of Android's CountDownTimer. However, CountDownTimer does not seem to stop after the call to onFinish() has been made.

I've tried to use cancel() to stop CountDownTimer, but the result is the same: CountDownTimer does not stop after the call to onFinish()

Here is the code I am running:

CountDownTimer cTimer = null;
cTimer = new CountDownTimer(array[onValue] * 1000, 1000) {
    public void onTick(long millisUntilFinished) {
        important.setText("" + millisUntilFinished / 1000);
    }
    public void onFinish() { }
};
cTimer.start();
important.setText("Test"); //does not run

0 个答案:

没有答案