I have a personal project in which I have to use a countdown timer, I'm using CountDownTimer, but I'm noticing a strange behavior when setting 60000 milliseconds, the count starts wrong (01:00 - 00:58 - 00:57 ...). Would I have resolved or should I look for another solution?
mTimer = new CountDownTimer(60000, 1000) {
public void onTick(long millisUntilFinished) {
int minutes = (int) (millisUntilFinished / 1000) / 60;
int seconds = (int) (millisUntilFinished / 1000) % 60;
mSecondsTextView.setText("" + String.format("%02d", seconds));
mMinutesTextView.setText("" + String.format("%02d", minutes));
Log.v("Timer", "Minutes " + minutes + " Seconds " + seconds);
}
public void onFinish() {
}
}.start();
02-14 00:44:31.111 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 1 Seconds 0 02-14 00:44:32.114 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 58 02-14 00:44:33.116 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 57 02-14 00:44:34.118 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 56 02-14 00:44:35.119 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 55 02-14 00:44:36.120 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 54 02-14 00:44:37.123 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 53 02-14 00:44:38.125 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 52 02-14 00:44:39.126 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 51 02-14 00:44:40.128 19540-19540/com.project.eddsato.pomodoroapp V/Timer: Minutes 0 Seconds 50