Android
android.widget
public class

android.widget.DatePicker

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.ViewGroup ViewManager ViewParent
android.widget.FrameLayout
android.widget.DatePicker

A view for selecting a month / year / day based on a calendar like layout. For a dialog using this view, see DatePickerDialog.

Nested Classes
DatePicker.OnDateChangedListener The callback used to indicate the user changes the date. 

Summary

XML Attributes inherited from class android.widget.FrameLayout
XML Attributes inherited from class android.view.ViewGroup
XML Attributes inherited from class android.view.View
Constants inherited from class android.view.ViewGroup
Constants inherited from class android.view.View
Fields inherited from class android.view.ViewGroup
Fields inherited from class android.view.View

Public Constructors

            DatePicker(Context context)
            DatePicker(Context context, AttributeSet attrs)
            DatePicker(Context context, AttributeSet attrs, int defStyle)

Public Methods

          int  getDayOfMonth()
          int  getMonth()
          int  getYear()
          void  init(int year, int monthOfYear, int dayOfMonth, DatePicker.OnDateChangedListener onDateChangedListener)
Initialize the state.
          void  setEnabled(boolean enabled)
Set the enabled state of this view.
          void  updateDate(int year, int monthOfYear, int dayOfMonth)

Protected Methods

          void  dispatchRestoreInstanceState(SparseArray<Parcelable> container)
Override so we are in complete control of save / restore for this widget.
          void  onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
          Parcelable  onSaveInstanceState()
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
Methods inherited from class android.widget.FrameLayout
Methods inherited from class android.view.ViewGroup
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.ViewManager
Methods inherited from interface android.view.ViewParent

Details

Public Constructors

public DatePicker(Context context)

public DatePicker(Context context, AttributeSet attrs)

public DatePicker(Context context, AttributeSet attrs, int defStyle)

Public Methods

public int getDayOfMonth()

public int getMonth()

public int getYear()

public void init(int year, int monthOfYear, int dayOfMonth, DatePicker.OnDateChangedListener onDateChangedListener)

Initialize the state.

Parameters

year The initial year.
monthOfYear The initial month.
dayOfMonth The initial day of the month.
onDateChangedListener How user is notified date is changed by user, can be null.

public void setEnabled(boolean enabled)

Set the enabled state of this view. The interpretation of the enabled state varies by subclass.

Parameters

enabled True if this view is enabled, false otherwise.

public void updateDate(int year, int monthOfYear, int dayOfMonth)

Protected Methods

protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container)

Override so we are in complete control of save / restore for this widget.

Parameters

container The SparseArray which holds previously saved state.

protected void onRestoreInstanceState(Parcelable state)

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState(). This function will never be called with a null state.

Parameters

state The frozen state that had previously been returned by onSaveInstanceState().

protected Parcelable onSaveInstanceState()

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.

Returns

  • Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56