-4

I want to create a countdown of 10 seconds. When countdown finishes calling a function.

enter code here

Thanks!

1 Answers1

2

It looks like there is already an api for just that:

 new CountDownTimer(30000, 1000) {

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

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

Reference: http://developer.android.com/reference/android/os/CountDownTimer.html

Zach Spencer
  • 1,859
  • 15
  • 21