MauroAlexandro MauroAlexandro - 3 months ago 7
Android Question

What's the best way to make a Count Down Timer?

I am wondering if this is the best way to make a timer of 1 minute on Android:

new CountDownTimer(60000, 1000) {

public void onTick(long millisUntilFinished) {

}

public void onFinish() {

}

}.start();

Answer

This is the easy and very simple way

new CountDownTimer(30000, 1000) {

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

     public void onFinish() {
         mTextField.setText("done!");
     }
  }.start();

for more info see this link