Code example for DatePicker

Methods: init

   * @return a DatePicker with the date set 
  protected View onCreateDialogView() {
    this.datePicker = new DatePicker(getContext());
    Calendar calendar = getDate();
    datePicker.init(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
        calendar.get(Calendar.DAY_OF_MONTH), this);
    return datePicker;
   * Produces the date used for the date picker. If the user has not selected a 
   * date, produces the default from the XML's android:defaultValue. If the 
   * default is not set in the XML or if the XML's default is invalid it uses 
   * the value produced by {@link #defaultCalendar()}. 
   * @return the Calendar for the date picker 
  public Calendar getDate() {