Code example for Calendar

Methods: getFirstDayOfWeek, set

0
    private YearPickerView mYearPickerView;
    private Button mDoneButton;
 
    private int mCurrentView = UNINITIALIZED;
 
    private int mWeekStart = mCalendar.getFirstDayOfWeek();
    private int mMinYear = DEFAULT_START_YEAR;
    private int mMaxYear = DEFAULT_END_YEAR;
 
    private Vibrator mVibrator;
    private long mLastVibrate;
 
    private boolean mDelayAnimation = true;
 
    // Accessibility strings. 
    private String mDayPickerDescription;
    private String mSelectDay;
    private String mYearPickerDescription;
    private String mSelectYear;
 
    /** 
     * The callback used to indicate the user is done filling in the date. 
     */ 
    public interface OnDateSetListener { 
 
        /** 
         * @param view The view associated with this listener. 
         * @param year The year that was set. 
         * @param monthOfYear The month that was set (0-11) for compatibility 
         *            with {@link java.util.Calendar}. 
         * @param dayOfMonth The day of the month that was set. 
         */ 
        void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth);
    } 
 
    /** 
     * The callback used to notify other date picker components of a change in selected date. 
     */ 
    interface OnDateChangedListener { 
 
        public void onDateChanged(); 
    } 
 
 
    public DatePickerDialog() { 
        // Empty constructor required for dialog fragment. 
    } 
 
    /** 
     * @param callBack How the parent is notified that the date is set. 
     * @param year The initial year of the dialog. 
     * @param monthOfYear The initial month of the dialog. 
     * @param dayOfMonth The initial day of the dialog. 
     */ 
    public static DatePickerDialog newInstance(OnDateSetListener callBack, int year,
            int monthOfYear,
            int dayOfMonth) {
        DatePickerDialog ret = new DatePickerDialog();
        ret.initialize(callBack, year, monthOfYear, dayOfMonth);
        return ret;
    } 
 
    public void initialize(OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
        mCallBack = callBack;
        mCalendar.set(Calendar.YEAR, year);
        mCalendar.set(Calendar.MONTH, monthOfYear);
        mCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);