Added in API level 1

TimePickerDialog


open class TimePickerDialog : AlertDialog, DialogInterface.OnClickListener, TimePicker.OnTimeChangedListener
kotlin.Any
   ↳ android.app.Dialog
   ↳ android.app.AlertDialog
   ↳ android.app.TimePickerDialog

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

See the Pickers guide.

Summary

Nested classes
abstract

The callback interface used to indicate the user is done filling in the time (e.g. they clicked on the 'OK' button).

Inherited constants
Public constructors
TimePickerDialog(context: Context!, listener: TimePickerDialog.OnTimeSetListener!, hourOfDay: Int, minute: Int, is24HourView: Boolean)

Creates a new time picker dialog.

TimePickerDialog(context: Context!, themeResId: Int, listener: TimePickerDialog.OnTimeSetListener!, hourOfDay: Int, minute: Int, is24HourView: Boolean)

Creates a new time picker dialog with the specified theme.

Public methods
open Unit
onClick(dialog: DialogInterface!, which: Int)

open Unit
onRestoreInstanceState(savedInstanceState: Bundle)

open Bundle

open Unit
onTimeChanged(view: TimePicker!, hourOfDay: Int, minute: Int)

open Unit

open Unit
updateTime(hourOfDay: Int, minuteOfHour: Int)

Sets the current time.

Inherited functions

Public constructors

TimePickerDialog

Added in API level 1
TimePickerDialog(
    context: Context!,
    listener: TimePickerDialog.OnTimeSetListener!,
    hourOfDay: Int,
    minute: Int,
    is24HourView: Boolean)

Creates a new time picker dialog.

Parameters
context Context!: the parent context
listener TimePickerDialog.OnTimeSetListener!: the listener to call when the time is set
hourOfDay Int: the initial hour
minute Int: the initial minute
is24HourView Boolean: whether this is a 24 hour view or AM/PM

TimePickerDialog

Added in API level 1
TimePickerDialog(
    context: Context!,
    themeResId: Int,
    listener: TimePickerDialog.OnTimeSetListener!,
    hourOfDay: Int,
    minute: Int,
    is24HourView: Boolean)

Creates a new time picker dialog with the specified theme.

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.

Parameters
context Context!: the parent context
themeResId Int: the resource ID of the theme to apply to this dialog
listener TimePickerDialog.OnTimeSetListener!: the listener to call when the time is set
hourOfDay Int: the initial hour
minute Int: the initial minute
is24HourView Boolean: Whether this is a 24 hour view, or AM/PM.

Public methods

onClick

Added in API level 1
open fun onClick(
    dialog: DialogInterface!,
    which: Int
): Unit
Parameters
dialog DialogInterface!: the dialog that received the click
which Int: the button that was clicked (ex. DialogInterface#BUTTON_POSITIVE) or the position of the item clicked

onRestoreInstanceState

Added in API level 1
open fun onRestoreInstanceState(savedInstanceState: Bundle): Unit
Parameters
savedInstanceState Bundle: The state of the dialog previously saved by onSaveInstanceState(). This value cannot be null.

onSaveInstanceState

Added in API level 1
open fun onSaveInstanceState(): Bundle
Return
Bundle A bundle with the state of the dialog. This value cannot be null.

onTimeChanged

Added in API level 1
open fun onTimeChanged(
    view: TimePicker!,
    hourOfDay: Int,
    minute: Int
): Unit
Parameters
view TimePicker!: The view associated with this listener.
hourOfDay Int: The current hour.
minute Int: The current minute.

show

Added in API level 1
open fun show(): Unit

updateTime

Added in API level 1
open fun updateTime(
    hourOfDay: Int,
    minuteOfHour: Int
): Unit

Sets the current time.

Parameters
hourOfDay Int: The current hour within the day.
minuteOfHour Int: The current minute within the hour.