What I want is a Chronometer UI component which goes back. In standard Chronometer all needed methods which show on UI chronometer data are private or final, so it is imposable to change its behavior.
Implementing own chronometer I could only imagine to use Timer and extend View and draw chronometer data on canvas according to state. But in this case I can’t modify the view, because all calls go from another Thread, because timer calls its scheduled tasks in another Thread. So I get CallFromWrongThreadException.
I took a look how standard Chronometer is implemented. There I found
@android.view.RemotableViewMethod
public void setBase(long base) {
mBase = base;
dispatchChronometerTick();
updateText(SystemClock.elapsedRealtime());
}
Couldn’t go into @android.view.RemotableViewMethod annotation inside. What the magic is here? How Chronometer updates its view according to time change? Is there some event I can listen for like SystemTimeChange..?
Implemented own chronometr extending TextView, with one timer task and handler, which get messages from timer task thread.