How to display Chronometer with H:MM:SS? I read MM:SS and H:MM:SS are displaying by default.I found only for MM:SS.
Here is my code for MM:SS with start and stop but
You can also set with attractive Chronometer format like 00 hrs : 00 min : 00 sec
chronometer.setText("00 hrs : 00 min : 00 sec");
chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
@Override
public void onChronometerTick(Chronometer chronometer) {
CharSequence text = chronometer.getText();
if (text.length() == 5) {
String a[] = text.toString().split(":");
String min = a[0] + " min : ";
String sec = a[1] + " sec";
chronometer.setText("00 hrs : " + min + sec);
} else if (text.length() == 7) {
String a[] = text.toString().split(":");
String hr = a[0] + " hrs : ";
String min = a[1] + " min : ";
String sec = a[2] + " sec";
chronometer.setText("0" + hr + min + sec);
}
}
});