-1

I need a countdown timer that will decrease its value from a specified time. For example 05:45:67. Now from this value when I start the timer it will go on decreasing until reaching the zero state.

Can you provide me with suitable examples of achieving this?

Michael Wild
  • 24,977
  • 3
  • 43
  • 43

1 Answers1

1

Hours, minutes and seconds are basicly multiplicities of thousand, 60 thousand and 3600 thousand of milliseconds. You can decrease number of milliseconds, construct Date object and format it in the way you wish. Something like this:

@Override
public void onTick(long millisUntilFinished) {
    String time = DateFormat.format("hh:mm:ss", new Date(millisUntilFinished));
    tv.setText(time);
}
Zielony
  • 16,239
  • 6
  • 34
  • 39