I've been attempting to format a countdown timer and haven't had much success. The timer counts down the correct amount of minutes/hours/seconds as input, however, upon output back to the user instead of a beautiful normal looking countdown timer look I get the following different outputs: When attempting to countdown from 25 minutes
When attempting to countdown from 25 minutes, then below I have when I attempt to countdown from 10 minutes: 10 minutes It appears to countdown properly with anything 1 minute or less.
This is the code I have to format the output, I have also included the code for the CounterClass which it is in.
private class CounterClass extends CountDownTimer {
public CounterClass(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) {
String hms = String.format("%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(millisUntilFinished),
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished),
TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished));
timeDisp.setText(hms);
}
}
Thanks in advance!