0

I have a simple program that displays a different text to a textview after 5 seconds which looks like this:

textView1 = (TextView)findViewById(R.id.textView1);
textView2 = (TextView)findViewById(R.id.textView2);

    new CountDownTimer(5000,5000) 
    {
        @Override
        public void onTick(long millisUntilFinished) {

        }


        @Override
        public void onFinish() {
            textView1.setText("text changed");
        }
    }.start();

want to display the timer as it counts (like 5, 4, 3, 2 , 1) in the TextView2

but I can't seem to figure out how.

Help, anyone? Thanks in advance. :)

K Guru
  • 1,292
  • 2
  • 17
  • 36
Suika
  • 660
  • 2
  • 10
  • 30

1 Answers1

0

Something like this? Taken from http://developer.android.com/reference/android/os/CountDownTimer.html

new CountDownTimer(5000, 1000) {

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

     public void onFinish() {
         textView1.setText("done!");
     }
  }.start();
Sam
  • 549
  • 5
  • 6