MaterialDatePicker.Builder

public final class MaterialDatePicker.Builder<S>


Used to create MaterialDatePicker instances with default and overridden settings

Summary

Public methods

MaterialDatePicker<S>

Creates a MaterialDatePicker with the provided options.

static MaterialDatePicker.Builder<Long>

Used to create a Builder that allows for choosing a single date in the MaterialDatePicker.

static MaterialDatePicker.Builder<Pair<Long, Long>>

Used to create a Builder that allows for choosing a date range in the MaterialDatePicker.

MaterialDatePicker.Builder<S>

Sets the first, last, and starting month.

MaterialDatePicker.Builder<S>

Sets the DayViewDecorator.

MaterialDatePicker.Builder<S>
setInputMode(int inputMode)

Sets the input mode to start with.

MaterialDatePicker.Builder<S>

Sets the content description used in the negative button

MaterialDatePicker.Builder<S>
setNegativeButtonContentDescription(int contentDescriptionId)

Sets the content description used in the negative button

MaterialDatePicker.Builder<S>

Sets the text used in the negative button

MaterialDatePicker.Builder<S>

Sets the text used in the negative button

MaterialDatePicker.Builder<S>

Sets the content description used in the positive button

MaterialDatePicker.Builder<S>
setPositiveButtonContentDescription(int contentDescriptionId)

Sets the content description used in the positive button

MaterialDatePicker.Builder<S>

Sets the text used in the positive button

MaterialDatePicker.Builder<S>

Sets the text used in the positive button

MaterialDatePicker.Builder<S>
setSelection(S selection)
MaterialDatePicker.Builder<S>

Sets the formatter that will be used to input dates using a keyboard.

MaterialDatePicker.Builder<S>
setTheme(int themeResId)

Sets the theme controlling fullscreen mode as well as other styles.

MaterialDatePicker.Builder<S>
setTitleText(CharSequence charSequence)

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

MaterialDatePicker.Builder<S>
setTitleText(int titleTextResId)

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

Public methods

build

public MaterialDatePicker<S> build()

Creates a MaterialDatePicker with the provided options.

datePicker

public static MaterialDatePicker.Builder<LongdatePicker()

Used to create a Builder that allows for choosing a single date in the MaterialDatePicker.

dateRangePicker

public static MaterialDatePicker.Builder<Pair<Long, Long>> dateRangePicker()

Used to create a Builder that allows for choosing a date range in the MaterialDatePicker.

setCalendarConstraints

public MaterialDatePicker.Builder<S> setCalendarConstraints(CalendarConstraints bounds)

Sets the first, last, and starting month.

setDayViewDecorator

public MaterialDatePicker.Builder<S> setDayViewDecorator(DayViewDecorator dayViewDecorator)

Sets the DayViewDecorator.

setInputMode

public MaterialDatePicker.Builder<S> setInputMode(int inputMode)

Sets the input mode to start with.

setNegativeButtonContentDescription

public MaterialDatePicker.Builder<S> setNegativeButtonContentDescription(CharSequence contentDescription)

Sets the content description used in the negative button

Parameters
CharSequence contentDescription

content description used in the negative button

setNegativeButtonContentDescription

public MaterialDatePicker.Builder<S> setNegativeButtonContentDescription(int contentDescriptionId)

Sets the content description used in the negative button

Parameters
int contentDescriptionId

resource id to be used as content description in the negative button

setNegativeButtonText

public MaterialDatePicker.Builder<S> setNegativeButtonText(CharSequence text)

Sets the text used in the negative button

Parameters
CharSequence text

text used in the negative button

setNegativeButtonText

public MaterialDatePicker.Builder<S> setNegativeButtonText(int textId)

Sets the text used in the negative button

Parameters
int textId

resource id to be used as text in the negative button

setPositiveButtonContentDescription

public MaterialDatePicker.Builder<S> setPositiveButtonContentDescription(CharSequence contentDescription)

Sets the content description used in the positive button

Parameters
CharSequence contentDescription

content description used in the positive button

setPositiveButtonContentDescription

public MaterialDatePicker.Builder<S> setPositiveButtonContentDescription(int contentDescriptionId)

Sets the content description used in the positive button

Parameters
int contentDescriptionId

resource id to be used as content description in the positive button

setPositiveButtonText

public MaterialDatePicker.Builder<S> setPositiveButtonText(CharSequence text)

Sets the text used in the positive button

Parameters
CharSequence text

text used in the positive button

setPositiveButtonText

public MaterialDatePicker.Builder<S> setPositiveButtonText(int textId)

Sets the text used in the positive button

Parameters
int textId

resource id to be used as text in the positive button

setSelection

public MaterialDatePicker.Builder<S> setSelection(S selection)

setTextInputFormat

public MaterialDatePicker.Builder<S> setTextInputFormat(SimpleDateFormat format)

Sets the formatter that will be used to input dates using a keyboard.

This affects the hint text and error suggestions of the date input field. Using this setter requires caution to ensure dates are formatted properly in different languages and locales.

Parameters
SimpleDateFormat format

a SimpleDateFormat used to format text input dates

setTheme

public MaterialDatePicker.Builder<S> setTheme(int themeResId)

Sets the theme controlling fullscreen mode as well as other styles.

setTitleText

public MaterialDatePicker.Builder<S> setTitleText(CharSequence charSequence)

Sets the text used to guide the user at the top of the picker. Setting to null will use a default title based upon the type of selection.

setTitleText

public MaterialDatePicker.Builder<S> setTitleText(int titleTextResId)

Sets the text used to guide the user at the top of the picker. Defaults to a standard title based upon the type of selection.