public class DatePickerDialog extends AlertDialog implements DialogInterface.OnClickListener, DatePicker.OnDateChangedListener
DatePicker
.
See the Pickers guide.
Modifier and Type | Class and Description |
---|---|
static interface |
DatePickerDialog.OnDateSetListener
The callback used to indicate the user is done filling in the date.
|
AlertDialog.Builder
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnShowListener
THEME_DEVICE_DEFAULT_DARK, THEME_DEVICE_DEFAULT_LIGHT, THEME_HOLO_DARK, THEME_HOLO_LIGHT, THEME_TRADITIONAL
mCancelable
BUTTON_NEGATIVE, BUTTON_NEUTRAL, BUTTON_POSITIVE, BUTTON1, BUTTON2, BUTTON3
Constructor and Description |
---|
DatePickerDialog(Context context,
DatePickerDialog.OnDateSetListener callBack,
int year,
int monthOfYear,
int dayOfMonth) |
DatePickerDialog(Context context,
int theme,
DatePickerDialog.OnDateSetListener callBack,
int year,
int monthOfYear,
int dayOfMonth) |
Modifier and Type | Method and Description |
---|---|
DatePicker |
getDatePicker()
Gets the
DatePicker contained in this dialog. |
void |
onClick(DialogInterface dialog,
int which)
This method will be invoked when a button in the dialog is clicked.
|
void |
onDateChanged(DatePicker view,
int year,
int month,
int day)
Called upon a date change.
|
void |
onRestoreInstanceState(Bundle savedInstanceState)
Restore the state of the dialog from a previously saved bundle.
|
Bundle |
onSaveInstanceState()
Saves the state of the dialog into a bundle.
|
protected void |
onStop()
Called to tell you that you're stopping.
|
void |
updateDate(int year,
int monthOfYear,
int dayOfMonth)
Sets the current date.
|
getButton, getListView, onCreate, onKeyDown, onKeyUp, setButton, setButton, setButton, setButton, setButton2, setButton2, setButton3, setButton3, setCustomTitle, setIcon, setIcon, setIconAttribute, setInverseBackgroundForced, setMessage, setTitle, setView, setView
addContentView, cancel, closeOptionsMenu, dismiss, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getVolumeControlStream, getWindow, hide, invalidateOptionsMenu, isShowing, onActionModeFinished, onActionModeStarted, onAttachedToWindow, onBackPressed, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onDetachedFromWindow, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onSearchRequested, onStart, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelable, setCanceledOnTouchOutside, setCancelMessage, setContentView, setContentView, setContentView, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOnShowListener, setOwnerActivity, setTitle, setVolumeControlStream, show, takeCancelAndDismissListeners, takeKeyEvents, unregisterForContextMenu
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, dismiss
public DatePickerDialog(Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
context
- The context the dialog is to run in.callBack
- How the parent is notified that the date is set.year
- The initial year of the dialog.monthOfYear
- The initial month of the dialog.dayOfMonth
- The initial day of the dialog.public DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
context
- The context the dialog is to run in.theme
- the theme to apply to this dialogcallBack
- How the parent is notified that the date is set.year
- The initial year of the dialog.monthOfYear
- The initial month of the dialog.dayOfMonth
- The initial day of the dialog.public void onClick(DialogInterface dialog, int which)
DialogInterface.OnClickListener
onClick
in interface DialogInterface.OnClickListener
dialog
- The dialog that received the click.which
- The button that was clicked (e.g.
DialogInterface.BUTTON1
) or the position
of the item clicked.public void onDateChanged(DatePicker view, int year, int month, int day)
DatePicker.OnDateChangedListener
onDateChanged
in interface DatePicker.OnDateChangedListener
view
- The view associated with this listener.year
- The year that was set.month
- The month that was set (0-11) for compatibility
with Calendar
.day
- The day of the month that was set.public DatePicker getDatePicker()
DatePicker
contained in this dialog.public void updateDate(int year, int monthOfYear, int dayOfMonth)
year
- The date year.monthOfYear
- The date month.dayOfMonth
- The date day of month.protected void onStop()
Dialog
public Bundle onSaveInstanceState()
Dialog
onSaveInstanceState
in class Dialog
public void onRestoreInstanceState(Bundle savedInstanceState)
Dialog
Dialog.onSaveInstanceState()
,
so be sure to call through to super when overriding unless you want to
do all restoring of state yourself.onRestoreInstanceState
in class Dialog
savedInstanceState
- The state of the dialog previously saved by
Dialog.onSaveInstanceState()
.