W3Schools Learner's Blog

W3Schools Programming knowledge summary website

div

4/28/2022

countDown timer in android

 How to use countdown timer in android? It's very easy. There a CountDownTimer class in android, For example:


  1. new CountDownTimer(30000, 1000) {

  2.     public void onTick(long millisUntilFinished) {
  3.          mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
  4.     }

  5.     public void onFinish() {
  6.          mTextField.setText("done!");
  7.     }

  8. }.start();

No comments:

Post a Comment

Note: only a member of this blog may post a comment.