MaterialTimePicker.Builder

public static final class MaterialTimePicker.Builder
extends Object

java.lang.Object
   ↳ com.google.android.material.timepicker.MaterialTimePicker.Builder


Used to create MaterialTimePicker instances.

Summary

Public constructors

Builder()

Public methods

MaterialTimePicker build()

Creates a MaterialTimePicker with the provided options.

MaterialTimePicker.Builder setHour(int hour)

Sets the hour with which to start the time picker.

MaterialTimePicker.Builder setInputMode(int inputMode)

Sets the input mode with which to start the time picker.

MaterialTimePicker.Builder setMinute(int minute)

Sets the minute with which to start the time picker.

MaterialTimePicker.Builder setNegativeButtonText(int negativeButtonTextResId)

Sets the text used in the negative action button.

MaterialTimePicker.Builder setNegativeButtonText(CharSequence negativeButtonText)

Sets the text used in the negative action button.

MaterialTimePicker.Builder setPositiveButtonText(CharSequence positiveButtonText)

Sets the text used in the positive action button.

MaterialTimePicker.Builder setPositiveButtonText(int positiveButtonTextResId)

Sets the text used in the positive action button.

MaterialTimePicker.Builder setTheme(int themeResId)

Sets the theme for the time picker.

MaterialTimePicker.Builder setTimeFormat(int format)

Sets the time format for the time picker.

MaterialTimePicker.Builder setTitleText(int titleTextResId)

Sets the text used to guide the user at the top of the picker.

MaterialTimePicker.Builder setTitleText(CharSequence charSequence)

Sets the text used to guide the user at the top of the picker.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public MaterialTimePicker build ()

Creates a MaterialTimePicker with the provided options.

Returns
MaterialTimePicker

setHour

public MaterialTimePicker.Builder setHour (int hour)

Sets the hour with which to start the time picker.

Parameters
hour int: The hour value is independent of the time format (setTimeFormat(int)), and should always be a number in the [0, 23] range.

Returns
MaterialTimePicker.Builder

setInputMode

public MaterialTimePicker.Builder setInputMode (int inputMode)

Sets the input mode with which to start the time picker.

Parameters
inputMode int

Returns
MaterialTimePicker.Builder

setMinute

public MaterialTimePicker.Builder setMinute (int minute)

Sets the minute with which to start the time picker.

Parameters
minute int

Returns
MaterialTimePicker.Builder

setNegativeButtonText

public MaterialTimePicker.Builder setNegativeButtonText (int negativeButtonTextResId)

Sets the text used in the negative action button.

Parameters
negativeButtonTextResId int

Returns
MaterialTimePicker.Builder

setNegativeButtonText

public MaterialTimePicker.Builder setNegativeButtonText (CharSequence negativeButtonText)

Sets the text used in the negative action button.

Parameters
negativeButtonText CharSequence

Returns
MaterialTimePicker.Builder

setPositiveButtonText

public MaterialTimePicker.Builder setPositiveButtonText (CharSequence positiveButtonText)

Sets the text used in the positive action button.

Parameters
positiveButtonText CharSequence

Returns
MaterialTimePicker.Builder

setPositiveButtonText

public MaterialTimePicker.Builder setPositiveButtonText (int positiveButtonTextResId)

Sets the text used in the positive action button.

Parameters
positiveButtonTextResId int

Returns
MaterialTimePicker.Builder

setTheme

public MaterialTimePicker.Builder setTheme (int themeResId)

Sets the theme for the time picker.

Parameters
themeResId int

Returns
MaterialTimePicker.Builder

setTimeFormat

public MaterialTimePicker.Builder setTimeFormat (int format)

Sets the time format for the time picker.

Parameters
format int: Either CLOCK_12H 12 hour format with an AM/PM toggle or CLOCK_24 24 hour format without toggle.

Returns
MaterialTimePicker.Builder

setTitleText

public MaterialTimePicker.Builder setTitleText (int titleTextResId)

Sets the text used to guide the user at the top of the picker.

Parameters
titleTextResId int

Returns
MaterialTimePicker.Builder

setTitleText

public MaterialTimePicker.Builder setTitleText (CharSequence charSequence)

Sets the text used to guide the user at the top of the picker.

Parameters
charSequence CharSequence

Returns
MaterialTimePicker.Builder