How to start chronometer in reverse in android?

android

Solution

You can't, the Chronometer widget only counts up, that's the specific purpose it was made for. If you want to count down, use the CountDownTimer (the Android SDK page contains a specific example where a TextView is updated), or roll your own solution.

These classes are trivial wrappers to save you some typing. You really shouldn't feel uncomfortable writing an alternative implementation if they don´t fit your exact needs.

[Update]

As Ronaldo Bahia added in the remarks, since API 24 the Chronometer actually offers this functionally through the setCountDown method.

Problem

``` cmtr.setText(finalTime); cmtr.setBase(SystemClock.elapsedRealtime()); timetest = SystemClock.elapsedRealtime(); Log.d("SETTIME: ", ""+timetest); cmtr.start(); eltime = SystemClock.elapsedRealtime(); Log.d("ELapsed: ", ""+eltime); ``` Note: i want to start my chronometer in reverse order. like i set chronometer 10 seconds. now, i want to start from 10 to 0 seconds in reverse order. so can anyone help to get this solution.? Thank you so much in advance.

Original source