Timer countdown formatting problems

84 views Asked by At

I'm using the below code to display a timer in the format "hh:mm:ss" and countdown from one day, however I get this output. How do I fix this?

 new CountDownTimer(86400000, 1000) { // adjust the milli seconds here

        public void onTick(long millisUntilFinished) {
            _tv.setText(""+String.format("%d H, %d MIN, %d SEC",
                    TimeUnit.MILLISECONDS.toHours(millisUntilFinished),
                    TimeUnit.MILLISECONDS.toMinutes( millisUntilFinished),
                    TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) -
                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished))));
        }

        public void onFinish() {
            _tv.setText("PLAY NOW!");
        }
    }.start();

enter image description here

0

There are 0 answers