Android APIs
public class

TimePickerDialog

extends AlertDialog
implements DialogInterface.OnClickListener TimePicker.OnTimeChangedListener
java.lang.Object
   ↳ android.app.Dialog
     ↳ android.app.AlertDialog
       ↳ android.app.TimePickerDialog

Class Overview

A dialog that prompts the user for the time of day using a TimePicker.

See the Pickers guide.

Summary

Nested Classes
interface TimePickerDialog.OnTimeSetListener The callback interface used to indicate the user is done filling in the time (they clicked on the 'Done' button). 
[Expand]
Inherited Constants
From class android.app.AlertDialog
From interface android.content.DialogInterface
Public Constructors
TimePickerDialog(Context context, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)
TimePickerDialog(Context context, int theme, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)
Public Methods
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 minutOfHour)
Protected Methods
void onStop()
Called to tell you that you're stopping.
[Expand]
Inherited Methods
From class android.app.AlertDialog
From class android.app.Dialog
From class java.lang.Object
From interface android.content.DialogInterface
From interface android.content.DialogInterface.OnClickListener
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface android.widget.TimePicker.OnTimeChangedListener

Public Constructors

public TimePickerDialog (Context context, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)

Added in API level 1

Parameters
context Parent.
callBack How parent is notified.
hourOfDay The initial hour.
minute The initial minute.
is24HourView Whether this is a 24 hour view, or AM/PM.

public TimePickerDialog (Context context, int theme, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView)

Added in API level 1

Parameters
context Parent.
theme the theme to apply to this dialog
callBack How parent is notified.
hourOfDay The initial hour.
minute The initial minute.
is24HourView Whether this is a 24 hour view, or AM/PM.

Public Methods

public void onClick (DialogInterface dialog, int which)

Added in API level 1

This method will be invoked when a button in the dialog is clicked.

Parameters
dialog The dialog that received the click.
which The button that was clicked (e.g. BUTTON1) or the position of the item clicked.

public void onRestoreInstanceState (Bundle savedInstanceState)

Added in API level 1

Restore the state of the dialog from a previously saved bundle. The default implementation restores the state of the dialog's view hierarchy that was saved in the default implementation of onSaveInstanceState(), so be sure to call through to super when overriding unless you want to do all restoring of state yourself.

Parameters
savedInstanceState The state of the dialog previously saved by onSaveInstanceState().

public Bundle onSaveInstanceState ()

Added in API level 1

Saves the state of the dialog into a bundle. The default implementation saves the state of its view hierarchy, so you'll likely want to call through to super if you override this to save additional state.

Returns
  • A bundle with the state of the dialog.

public void onTimeChanged (TimePicker view, int hourOfDay, int minute)

Added in API level 1

public void updateTime (int hourOfDay, int minutOfHour)

Added in API level 1

Protected Methods

protected void onStop ()

Added in API level 1

Called to tell you that you're stopping.