@Override protected void onWindowVisibilityChanged(int visibility) { super.onWindowVisibilityChanged(visibility); mVisible = visibility == VISIBLE; updateRunning(); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mVisible = false; updateRunning(); }
/** * Stop counting up. This does not affect the base as set from {@link #setBase}, just the view * display. * * <p>This stops the messages to the handler, effectively releasing resources that would be held * as the chronometer is running, via {@link #start}. */ public void stop() { mStarted = false; updateRunning(); }
/** * The same as calling {@link #start} or {@link #stop}. * * @hide pending API council approval */ @android.view.RemotableViewMethod public void setStarted(boolean started) { mStarted = started; updateRunning(); }
/** * Start counting up. This does not affect the base as set from {@link #setBase}, just the view * display. * * <p>Chronometer works by regularly scheduling messages to the handler, even when the Widget is * not visible. To make sure resource leaks do not occur, the user should make sure that each * start() call has a reciprocal call to {@link #stop}. */ public void start() { mStarted = true; updateRunning(); }