Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tv = new TextView(this);
- this.setContentView(tv);
- //10000 is the starting number (in milliseconds)
- //1000 is the number to count down each time (in milliseconds)
- MyCount counter = new MyCount(10000,1000);
- counter.start();
- }
- //countdowntimer is an abstract class, so extend it and fill in methods
- public class MyCount extends CountDownTimer
- {
- public MyCount(long millisInFuture, long countDownInterval)
- {
- super(millisInFuture, countDownInterval);
- }
- public void onFinish()
- {
- tv.setText("Time Up!");
- }
- public void onTick(long millisUntilFinished)
- {
- tv.setText("Time Left : " + millisUntilFinished/1000);
- }
Add Comment
Please, Sign In to add comment