Checking if CountDownTimer is running

前端 未结 3 2058
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 21:36

Ive been looking to see a method to see if a CountDownTimer is running or not, but I cant find a way to, any help would be greatly appreciated

if (position =         


        
3条回答
  •  佛祖请我去吃肉
    2021-01-03 22:22

    Just put a boolean flag which indicate that by following code

    boolean isRunning = false;
    
    mCountDown = new CountDownTimer((300 * 1000), 1000) {
    
        public void onTick(long millisUntilFinished) {
            isRunning = true;
            //rest of code
        }
    
        public void onFinish() {
            isRunning= false;
            //rest of code
        }
    }.start();
    

提交回复
热议问题