public class TimePickerDialog extends AlertDialog implements DialogInterface.OnClickListener, TimePicker.OnTimeChangedListener
TimePicker
.
See the Pickers guide.
Modifier and Type | Class and Description |
---|---|
static interface |
TimePickerDialog.OnTimeSetListener
The callback interface used to indicate the user is done filling in
the time (e.g. they clicked on the 'OK' button).
|
AlertDialog.Builder
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnShowListener
LAYOUT_HINT_NONE, LAYOUT_HINT_SIDE, 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 |
---|
TimePickerDialog(Context context,
int themeResId,
TimePickerDialog.OnTimeSetListener listener,
int hourOfDay,
int minute,
boolean is24HourView)
Creates a new time picker dialog with the specified theme.
|
TimePickerDialog(Context context,
TimePickerDialog.OnTimeSetListener listener,
int hourOfDay,
int minute,
boolean is24HourView)
Creates a new time picker dialog.
|
Modifier and Type | Method and Description |
---|---|
TimePicker |
getTimePicker() |
void |
onClick(DialogInterface dialog,
int which)
This method will be invoked when a button in the dialog is clicked.
|
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.
|
void |
onTimeChanged(TimePicker view,
int hourOfDay,
int minute) |
void |
updateTime(int hourOfDay,
int minuteOfHour)
Sets the current time.
|
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, create, dismiss, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getSearchEvent, 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, onSearchRequested, onStart, onStop, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowDismissed, onWindowFocusChanged, onWindowStartingActionMode, 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
onProvideKeyboardShortcuts
public TimePickerDialog(Context context, TimePickerDialog.OnTimeSetListener listener, int hourOfDay, int minute, boolean is24HourView)
context
- the parent contextlistener
- the listener to call when the time is sethourOfDay
- the initial hourminute
- the initial minuteis24HourView
- whether this is a 24 hour view or AM/PMpublic TimePickerDialog(Context context, int themeResId, TimePickerDialog.OnTimeSetListener listener, int hourOfDay, int minute, boolean is24HourView)
The theme is overlaid on top of the theme of the parent context
.
If themeResId
is 0, the dialog will be inflated using the theme
specified by the
android:timePickerDialogTheme
attribute on the parent context
's theme.
context
- the parent contextthemeResId
- the resource ID of the theme to apply to this dialoglistener
- the listener to call when the time is sethourOfDay
- the initial hourminute
- the initial minuteis24HourView
- Whether this is a 24 hour view, or AM/PM.public TimePicker getTimePicker()
public void onTimeChanged(TimePicker view, int hourOfDay, int minute)
onTimeChanged
in interface TimePicker.OnTimeChangedListener
view
- The view associated with this listener.hourOfDay
- The current hour.minute
- The current minute.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 updateTime(int hourOfDay, int minuteOfHour)
hourOfDay
- The current hour within the day.minuteOfHour
- The current minute within the hour.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()
.