Estou com um projeto pessoal na qual tenho que usar um contador regressivo, estou usando o CountDownTimer, mas estou percebendo um comportamento estranho, ao setar 60000 milissegundos, a contagem começa errada (01:00 - 00:58 - 00:57 …). Teria como resolver ou devo procurar outra solução?
public void startCountDownTimer (){
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