Code example for Calendar

Methods: getTimeZone, setTimeInMillis

0
            String action = intent.getAction(); 
            if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) { 
                String tz = intent.getStringExtra("time-zone"); 
                mCalendar = Calendar.getInstance(TimeZone.getTimeZone(tz)); 
                if (mClockFormat != null) { 
                    mClockFormat.setTimeZone(mCalendar.getTimeZone()); 
                } 
            } 
            updateClock(); 
        } 
    }; 
 
    final void updateClock() { 
        mCalendar.setTimeInMillis(System.currentTimeMillis());
        setText(getSmallTime());
    } 
 
    private final CharSequence getSmallTime() {
        Context context = getContext();
        boolean b24 = DateFormat.is24HourFormat(context);
        int res;