net.simonvt.datepicker
Class DatePickerDialog

java.lang.Object
  extended by android.app.Dialog
      extended by android.app.AlertDialog
          extended by net.simonvt.datepicker.DatePickerDialog
All Implemented Interfaces:
android.content.DialogInterface, android.content.DialogInterface.OnClickListener, android.view.KeyEvent.Callback, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback, DatePicker.OnDateChangedListener

public class DatePickerDialog
extends android.app.AlertDialog
implements android.content.DialogInterface.OnClickListener, DatePicker.OnDateChangedListener

A simple dialog containing an DatePicker.

See the Pickers guide.


Nested Class Summary
static interface DatePickerDialog.OnDateSetListener
          The callback used to indicate the user is done filling in the date.
 
Nested classes/interfaces inherited from class android.app.AlertDialog
android.app.AlertDialog.Builder
 
Nested classes/interfaces inherited from interface android.content.DialogInterface
android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnDismissListener, android.content.DialogInterface.OnKeyListener, android.content.DialogInterface.OnMultiChoiceClickListener, android.content.DialogInterface.OnShowListener
 
Field Summary
 
Fields inherited from class android.app.AlertDialog
THEME_DEVICE_DEFAULT_DARK, THEME_DEVICE_DEFAULT_LIGHT, THEME_HOLO_DARK, THEME_HOLO_LIGHT, THEME_TRADITIONAL
 
Fields inherited from interface android.content.DialogInterface
BUTTON_NEGATIVE, BUTTON_NEUTRAL, BUTTON_POSITIVE, BUTTON1, BUTTON2, BUTTON3
 
Constructor Summary
DatePickerDialog(android.content.Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
           
DatePickerDialog(android.content.Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
           
 
Method Summary
 DatePicker getDatePicker()
          Gets the DatePicker contained in this dialog.
 void onClick(android.content.DialogInterface dialog, int which)
           
 void onDateChanged(DatePicker view, int year, int month, int day)
          Called upon a date change.
 void onRestoreInstanceState(android.os.Bundle savedInstanceState)
           
 android.os.Bundle onSaveInstanceState()
           
protected  void onStop()
           
 void updateDate(int year, int monthOfYear, int dayOfMonth)
          Sets the current date.
 
Methods inherited from class android.app.AlertDialog
getButton, getListView, onCreate, onKeyDown, onKeyUp, setButton, setButton, setButton, setButton, setButton2, setButton2, setButton3, setButton3, setCustomTitle, setIcon, setIcon, setIconAttribute, setInverseBackgroundForced, setMessage, setTitle, setView, setView
 
Methods inherited from class android.app.Dialog
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, takeKeyEvents, unregisterForContextMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.content.DialogInterface
cancel, dismiss
 

Constructor Detail

DatePickerDialog

public DatePickerDialog(android.content.Context context,
                        DatePickerDialog.OnDateSetListener callBack,
                        int year,
                        int monthOfYear,
                        int dayOfMonth)
Parameters:
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.

DatePickerDialog

public DatePickerDialog(android.content.Context context,
                        int theme,
                        DatePickerDialog.OnDateSetListener callBack,
                        int year,
                        int monthOfYear,
                        int dayOfMonth)
Parameters:
context - The context the dialog is to run in.
theme - the theme to apply to this dialog
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.
Method Detail

onClick

public void onClick(android.content.DialogInterface dialog,
                    int which)
Specified by:
onClick in interface android.content.DialogInterface.OnClickListener

onDateChanged

public void onDateChanged(DatePicker view,
                          int year,
                          int month,
                          int day)
Description copied from interface: DatePicker.OnDateChangedListener
Called upon a date change.

Specified by:
onDateChanged in interface DatePicker.OnDateChangedListener
Parameters:
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.

getDatePicker

public DatePicker getDatePicker()
Gets the DatePicker contained in this dialog.

Returns:
The calendar view.

updateDate

public void updateDate(int year,
                       int monthOfYear,
                       int dayOfMonth)
Sets the current date.

Parameters:
year - The date year.
monthOfYear - The date month.
dayOfMonth - The date day of month.

onStop

protected void onStop()
Overrides:
onStop in class android.app.Dialog

onSaveInstanceState

public android.os.Bundle onSaveInstanceState()
Overrides:
onSaveInstanceState in class android.app.Dialog

onRestoreInstanceState

public void onRestoreInstanceState(android.os.Bundle savedInstanceState)
Overrides:
onRestoreInstanceState in class android.app.Dialog


Copyright © 2012-2013. All Rights Reserved.