I knew the format of chronometer can be MM:SS or HH:MM:SS, but I want to know how to use setFormat() and getFormat() to set HH:MM:SS pattern(now is MM:SS).
At this time, I use:
android:format="@string/chronometer_initial_format"
to set Format by declare:
<xliff:g id="initial-format">%1$s</xliff:g>
at res/values/strings.xml
I tried to search by googling, but can't get good answer. Anyone can suggest ? Thank you
From http://developer.android.com/reference/android/widget/Chronometer.html#setFormat%28java.lang.String%29:
The display of the
H:MM:SS
output depends on the elapsed time: you can not explicitly choose to display the hours. If it has been more than an hour since it started then it will display the hour number, otherwise it will only display the minutes and seconds.Also, your format must only have
%s
: I don't believe you can use%1$s
or other indexed format specifiers.