Code example for DatePicker

Methods: clearFocusgetDayOfMonthgetMonthgetYear

0
   * and {@link #onDialogClosed(boolean)}. Be sure to call the super when overriding. 
   */ 
  @Override 
  public void onClick(DialogInterface dialog, int which) {
    super.onClick(dialog, which);
    datePicker.clearFocus();
    onDateChanged(datePicker, datePicker.getYear(), datePicker.getMonth(),
        datePicker.getDayOfMonth());
    onDialogClosed(which == DialogInterface.BUTTON1); // OK?
  } 
 
  /** 
   * Produces the date the user has selected for the given preference, as a 
   * calendar. 
   *  
   * @param preferences 
   *          the SharedPreferences to get the date from 
   * @param field 
   *          the name of the preference to get the date from 
   * @return a Calendar that the user has selected 
   */