How to start chronometer in reverse in android?
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.
For those who are still looking for other options and a View, I suggest using the Chronometer widget and setting setCountDown (boolean) to true.
As an example, in your activity or fragment:
view_timer.base = SystemClock.elapsedRealtime() + 10000
view_timer.start()
For the widget in the layout .xml:
<Chronometer
android:id="@+id/view_timer"
android:countDown="true"
tools:targetApi="24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Also possible to use setCountDown(true); https://developer.android.com/reference/android/widget/Chronometer.html
You can't chronometer widget for counts down. use CountDownTimer example below here my count down start from 01:45 mins 1sec = 1000
CountDownTimer cT = new CountDownTimer(100000, 1000) {
public void onTick(long millisUntilFinished) {
String v = String.format("%02d", millisUntilFinished/60000);
int va = (int)( (millisUntilFinished%60000)/1000);
textView.setText("seconds remaining: " +v+":"+String.format("%02d",va));
}
public void onFinish() {
textView.setText("done!");
}
};
cT.start();