After some testing, I came up with this code. It is not fully tested, but you can provide me more information if you
private void formatChronometerText(Chronometer c) { int cTextSize = c.getText().length(); if (cTextSize == 5) { breakingTime.setFormat("00:%s"); } else if (cTextSize == 7) { breakingTime.setFormat("0%s"); } else if (cTextSize == 8) { breakingTime.setFormat("%s"); } }
I called this method in the onCreate() method, for example.
Chronometer c = ... ... formatChronometerText(c); c.setText("00:00:00");
I will be back in a day to check if it works, or if it needs to be called also after changing the text size. If you are a cautious person, I suggest you name him in the same context with c.start() and c.stop()
if(ticking){ c.stop(); formatChronometerText(c); } else { formatChronometerText(c); c.start() }
mad_raz
source share