MaterialTimePicker

public final class MaterialTimePicker


A Dialog with a clock display and a clock face to choose the time.

For more information, see the component developer guidance and design guidelines.

Summary

Nested types

public final class MaterialTimePicker.Builder

Used to create MaterialTimePicker instances.

Constants

static final int
static final int

Public constructors

Public methods

boolean
addOnCancelListener(OnCancelListener listener)

The supplied listener is called when the user cancels the picker via back button or a touch outside the view.

boolean
addOnDismissListener(OnDismissListener listener)

The supplied listener is called whenever the DialogFragment is dismissed, no matter how it is dismissed.

boolean
addOnNegativeButtonClickListener(OnClickListener listener)

The supplied listener is called when the user clicks the cancel button.

boolean
addOnPositiveButtonClickListener(OnClickListener listener)

The supplied listener is called when the user confirms a valid selection.

void

Removes all listeners added via addOnCancelListener.

void

Removes all listeners added via addOnDismissListener.

void

Removes all listeners added via addOnNegativeButtonClickListener.

void

Removes all listeners added via addOnPositiveButtonClickListener.

int

Returns the hour of day in the range [0, 23].

int
int

Returns the minute in the range [0, 59].

final void
onCancel(DialogInterface dialogInterface)
void
onCreate(Bundle bundle)
final Dialog
onCreateDialog(Bundle bundle)
final View
onCreateView(
    LayoutInflater layoutInflater,
    ViewGroup viewGroup,
    Bundle bundle
)
void
final void
onDismiss(DialogInterface dialogInterface)
void
onSaveInstanceState(Bundle bundle)
void
onViewCreated(View view, Bundle bundle)
boolean
removeOnCancelListener(OnCancelListener listener)

Removes a listener previously added via addOnCancelListener.

boolean
removeOnDismissListener(OnDismissListener listener)

Removes a listener previously added via addOnDismissListener.

boolean
removeOnNegativeButtonClickListener(OnClickListener listener)

Removes a listener previously added via addOnNegativeButtonClickListener.

boolean
removeOnPositiveButtonClickListener(OnClickListener listener)

Removes a listener previously added via addOnPositiveButtonClickListener.

void
setCancelable(boolean cancelable)
void
setHour(int hour)

Sets the hour of day in the range [0, 23].

void
setMinute(int minute)

Sets the minute in the range [0, 59].

Constants

INPUT_MODE_CLOCK

public static final int INPUT_MODE_CLOCK = 0

INPUT_MODE_KEYBOARD

public static final int INPUT_MODE_KEYBOARD = 1

Public fields

inputMode

@MaterialTimePicker.InputMode
public int inputMode

Public constructors

MaterialTimePicker

public MaterialTimePicker()

Public methods

addOnCancelListener

public boolean addOnCancelListener(OnCancelListener listener)

The supplied listener is called when the user cancels the picker via back button or a touch outside the view.

It is not called when the user clicks the cancel button. To add a listener for use when the user clicks the cancel button, use addOnNegativeButtonClickListener.

addOnDismissListener

public boolean addOnDismissListener(OnDismissListener listener)

The supplied listener is called whenever the DialogFragment is dismissed, no matter how it is dismissed.

addOnNegativeButtonClickListener

public boolean addOnNegativeButtonClickListener(OnClickListener listener)

The supplied listener is called when the user clicks the cancel button.

addOnPositiveButtonClickListener

public boolean addOnPositiveButtonClickListener(OnClickListener listener)

The supplied listener is called when the user confirms a valid selection.

clearOnCancelListeners

public void clearOnCancelListeners()

Removes all listeners added via addOnCancelListener.

clearOnDismissListeners

public void clearOnDismissListeners()

Removes all listeners added via addOnDismissListener.

clearOnNegativeButtonClickListeners

public void clearOnNegativeButtonClickListeners()

Removes all listeners added via addOnNegativeButtonClickListener.

clearOnPositiveButtonClickListeners

public void clearOnPositiveButtonClickListeners()

Removes all listeners added via addOnPositiveButtonClickListener.

getHour

public int getHour()

Returns the hour of day in the range [0, 23].

getInputMode

@MaterialTimePicker.InputMode
public int getInputMode()

getMinute

public int getMinute()

Returns the minute in the range [0, 59].

onCancel

public final void onCancel(DialogInterface dialogInterface)

onCreate

public void onCreate(Bundle bundle)

onCreateDialog

public final Dialog onCreateDialog(Bundle bundle)

onCreateView

public final View onCreateView(
    LayoutInflater layoutInflater,
    ViewGroup viewGroup,
    Bundle bundle
)

onDestroyView

public void onDestroyView()

onDismiss

public final void onDismiss(DialogInterface dialogInterface)

onSaveInstanceState

public void onSaveInstanceState(Bundle bundle)

onViewCreated

public void onViewCreated(View view, Bundle bundle)

removeOnCancelListener

public boolean removeOnCancelListener(OnCancelListener listener)

Removes a listener previously added via addOnCancelListener.

removeOnDismissListener

public boolean removeOnDismissListener(OnDismissListener listener)

Removes a listener previously added via addOnDismissListener.

removeOnNegativeButtonClickListener

public boolean removeOnNegativeButtonClickListener(OnClickListener listener)

Removes a listener previously added via addOnNegativeButtonClickListener.

removeOnPositiveButtonClickListener

public boolean removeOnPositiveButtonClickListener(OnClickListener listener)

Removes a listener previously added via addOnPositiveButtonClickListener.

setCancelable

public void setCancelable(boolean cancelable)

setHour

public void setHour(int hour)

Sets the hour of day in the range [0, 23].

setMinute

public void setMinute(int minute)

Sets the minute in the range [0, 59].