Android
android.widget
public class

android.widget.TimePicker

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

A view for selecting the time of day, in either 24 hour or AM/PM mode. The hour, each minute digit, and AM/PM (if applicable) can be conrolled by vertical spinners. The hour can be entered by keyboard input. Entering in two digit hours can be accomplished by hitting two digits within a timeout of about a second (e.g. '1' then '2' to select 12). The minutes can be entered by entering single digits. Under AM/PM mode, the user can hit 'a', 'A", 'p' or 'P' to pick. For a dialog using this view, see TimePickerDialog.

Nested Classes
TimePicker.OnTimeChangedListener The callback interface used to indicate the time has been adjusted. 

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

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

Public Methods

          int  getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary.

          Integer  getCurrentHour()
          Integer  getCurrentMinute()
          boolean  is24HourView()
          void  setCurrentHour(Integer currentHour)
Set the current hour.
          void  setCurrentMinute(Integer currentMinute)
Set the current minute (0-59).
          void  setEnabled(boolean enabled)
Set the enabled state of this view.
          void  setIs24HourView(Boolean is24HourView)
Set whether in 24 hour or AM/PM mode.
          void  setOnTimeChangedListener(TimePicker.OnTimeChangedListener onTimeChangedListener)
Set the callback that indicates the time has been adjusted by the user.

Protected Methods

          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 TimePicker(Context context)

public TimePicker(Context context, AttributeSet attrs)

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

Public Methods

public int getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.

Returns

  • the offset of the baseline within the widget's bounds or -1 if baseline alignment is not supported

public Integer getCurrentHour()

Returns

  • The current hour (0-23).

public Integer getCurrentMinute()

Returns

  • The current minute.

public boolean is24HourView()

Returns

  • true if this is in 24 hour view else false.

public void setCurrentHour(Integer currentHour)

Set the current hour.

public void setCurrentMinute(Integer currentMinute)

Set the current minute (0-59).

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 setIs24HourView(Boolean is24HourView)

Set whether in 24 hour or AM/PM mode.

Parameters

is24HourView True = 24 hour mode. False = AM/PM.

public void setOnTimeChangedListener(TimePicker.OnTimeChangedListener onTimeChangedListener)

Set the callback that indicates the time has been adjusted by the user.

Parameters

onTimeChangedListener the callback, should not be null.

Protected Methods

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