Now let's get the timer in Minute and seconds
1-
CountDownTimer countDownTimer; long duration = 300000;
1000) { public void onTick(long millisUntilFinished) { String.format("%d min, %d sec", TimeUnit.MILLISECONDS.toMinutes ( millisUntilFinished), TimeUnit.MILLISECONDS.toSeconds (millisUntilFinished) - TimeUnit.MINUTES.toSeconds( TimeUnit.MILLISECONDS. toMinutes(millisUntilFinished)))); } |
To get the timer in seconds only click here
if want to stop the timer before the finish time;
countDownTimer.cancel(); |
No comments:
Post a Comment