Code example for Handler

0
    private AmPm mAmPm;
    private ContentObserver mFormatChangeObserver;
    private int mAttached = 0; // for debugging - tells us whether attach/detach is unbalanced
 
    /* called by system on minute ticks */ 
    private final Handler mHandler = new Handler();
    private BroadcastReceiver mIntentReceiver;
 
    private static class TimeChangedReceiver extends BroadcastReceiver {
        private WeakReference<ClockView> mClock;
        private Context mContext;
 
        public TimeChangedReceiver(ClockView clock) {
            mClock = new WeakReference<ClockView>(clock);
            mContext = clock.getContext();
        } 
 
        @Override 
        public void onReceive(Context context, Intent intent) {
            // Post a runnable to avoid blocking the broadcast. 
            final boolean timezoneChanged =