# GuidedDatePickerAction

Artifact: [androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/GuidedDatePickerAction.java+class:androidx.leanback.widget.GuidedDatePickerAction) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***


```
public class GuidedDatePickerAction extends GuidedAction
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.leanback.widget.Action](https://developer.android.com/reference/androidx/leanback/widget/Action) |||
|   | ↳ | [androidx.leanback.widget.GuidedAction](https://developer.android.com/reference/androidx/leanback/widget/GuidedAction) ||
|   |   | ↳ | [androidx.leanback.widget.GuidedDatePickerAction](https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction) |

*** ** * ** ***

Subclass of GuidedAction that can choose a date. The Action is editable by default; to make it read only, call hasEditableActivatorView(false) on the Builder.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction.Builder extends https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction.BuilderBase<https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction.Builder>` Builder class to build a GuidedDatePickerAction. |
| `public abstract class https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction.BuilderBase<B extends https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction.BuilderBase> extends https://developer.android.com/reference/androidx/leanback/widget/GuidedAction.BuilderBase<B>` Base Builder class to build GuidedDatePickerAction. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#GuidedDatePickerAction()()` |

| ### Public methods |
|---|---|
| `long` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#getDate()()` Get current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#getDatePickerFormat()()` Returns format of date Picker or null if not specified. |
| `long` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#getMaxDate()()` Get maximum value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone. |
| `long` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#getMinDate()()` Get minimal value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone. -1 if not set. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#onRestoreInstanceState(android.os.Bundle,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html key)` Restore action from a bundle using a given key. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#onSaveInstanceState(android.os.Bundle,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html key)` Save action into a bundle using a given key. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction#setDate(long)(long date)` Sets current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone. |

### Inherited Constants

From [androidx.leanback.widget.Action](https://developer.android.com/reference/androidx/leanback/widget/Action) `static final long` `https://developer.android.com/reference/androidx/leanback/widget/Action#NO_ID() = -1`

Indicates that an id has not been set.
From [androidx.leanback.widget.GuidedAction](https://developer.android.com/reference/androidx/leanback/widget/GuidedAction) `static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_CANCEL() = -5`

Id of standard Cancel action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_CONTINUE() = -7`

Id of standard Finish action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_CURRENT() = -3`

When finishing editing, stay on current action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_FINISH() = -6`

Id of standard Finish action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_NEXT() = -2`

When finishing editing, goes to next action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_NO() = -9`

Id of standard No action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_OK() = -4`

Id of standard OK action.
`static final long` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#ACTION_ID_YES() = -8`

Id of standard Yes action.
`static final int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#CHECKBOX_CHECK_SET_ID() = -1`

Checkset Id for checkbox.
`static final int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#DEFAULT_CHECK_SET_ID() = 1`

Default checkset Id for radio.
`static final int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#NO_CHECK_SET() = 0`

Special check set Id that is neither checkbox nor radio.

### Inherited methods

From [androidx.leanback.widget.Action](https://developer.android.com/reference/androidx/leanback/widget/Action) `final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#addKeyCode(int)(int keyCode)`

Adds a keycode used to invoke this Action.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html` `https://developer.android.com/reference/androidx/leanback/widget/Action#getIcon()()`

Returns the icon drawable for this Action.
`final long` `https://developer.android.com/reference/androidx/leanback/widget/Action#getId()()`

Returns the id for this Action.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/Action#getLabel1()()`

Returns the first line label for this Action.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/Action#getLabel2()()`

Returns the second line label for this Action.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#removeKeyCode(int)(int keyCode)`

Removes a keycode used to invoke this Action.
`final boolean` `https://developer.android.com/reference/androidx/leanback/widget/Action#respondsToKeyCode(int)(int keyCode)`

Returns true if the Action should respond to the given keycode.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#setIcon(android.graphics.drawable.Drawable)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html icon)`

Sets the icon drawable for this Action.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#setId(long)(long id)`

Sets the id for this Action.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#setLabel1(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html label)`

Sets the first line label for this Action.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/Action#setLabel2(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html label)`

Sets the second line label for this Action.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/leanback/widget/Action#toString()()` From [androidx.leanback.widget.GuidedAction](https://developer.android.com/reference/androidx/leanback/widget/GuidedAction) `String[]` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getAutofillHints()()`

Returns autofill hints, see `https://developer.android.com/reference/android/view/View.html#setAutofillHints(java.lang.String...)`.
`int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getCheckSetId()()`

Returns the check set id this action is a part of.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getDescription()()`

Returns the description of this action.
`int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getDescriptionEditInputType()()`

Returns InputType of action description in editing; only valid when `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isDescriptionEditable()` is true.
`int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getDescriptionInputType()()`

Returns InputType of action description not in editing.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getEditDescription()()`

Returns the optional description text to edit.
`int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getEditInputType()()`

Returns InputType of action title in editing; only valid when `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEditable()` is true.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getEditTitle()()`

Returns the optional title text to edit.
`int` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getInputType()()`

Returns InputType of action title not in editing.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getIntent()()`

Returns the intent associated with this action.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/leanback/widget/GuidedAction>` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getSubActions()()` `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getTitle()()`

Returns the title of this action.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#hasEditableActivatorView()()`

Returns whether this action can be activated to edit, e.g. a DatePicker.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#hasMultilineDescription()()`

Returns whether this action is has a multiline description.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#hasNext()()`

Returns whether this action will request further user input when selected, such as showing another GuidedStepFragment or launching a new activity.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#hasSubActions()()` `boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#hasTextEditable()()`

Returns if this action has editable title or editable description.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#infoOnly()()`

Returns whether the action will only display information and is thus not clickable.
`final boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isAutoSaveRestoreEnabled()()`

Returns true if Action will be saved to instanceState and restored later, false otherwise.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isChecked()()`

Returns whether this action is checked.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isDescriptionEditable()()`

Returns whether this action description is editable.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEditTitleUsed()()`

Returns true if `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getEditTitle()` is not null.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEditable()()`

Returns whether this action title is editable.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEnabled()()`

Returns whether this action is enabled.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isFocusable()()`

Returns whether this action is focusable.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setChecked(boolean)(boolean checked)`

Sets whether this action is checked.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setDescription(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html description)`

Sets the description of this action.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setEditDescription(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html editDescription)`

Sets the optional description text to edit instead of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setDescription(java.lang.CharSequence)`.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setEditTitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html editTitle)`

Sets the optional title text to edit instead of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setTitle(java.lang.CharSequence)`.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setEnabled(boolean)(boolean enabled)`

Sets whether this action is enabled.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setFocusable(boolean)(boolean focusable)`

Sets whether this action is focusable.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setIntent(android.content.Intent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html intent)`

Sets the intent of this action.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setSubActions(java.util.List<androidx.leanback.widget.GuidedAction>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/leanback/widget/GuidedAction> actions)`

Change sub actions list.
`void` `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#setTitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html title)`

Sets the title of this action.

## Public constructors

### GuidedDatePickerAction

Added in 1.1.0

```
public GuidedDatePickerAction()
```

## Public methods

### getDate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public long getDate()
```

Get current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone.

| Returns |
|---|---|
| `long` | Current value of DatePicker Action. |

### getDatePickerFormat

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public @Nullable String getDatePickerFormat()
```

Returns format of date Picker or null if not specified. The format is a case insensitive String containing the \* day ('d'), month ('m'), and year ('y'). When the format is not specified, a default format of current locale will be used.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | Format of showing Date, e.g. "YMD". Returns null if using current locale's default. |

### getMaxDate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public long getMaxDate()
```

Get maximum value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone.

| Returns |
|---|---|
| `long` | Maximum value of DatePicker Action or Long.MAX_VALUE if not set. |

### getMinDate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public long getMinDate()
```

Get minimal value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone. -1 if not set.

| Returns |
|---|---|
| `long` | Minimal value of DatePicker Action or Long.MIN_VALUE if not set. |

### onRestoreInstanceState

```
public void onRestoreInstanceState(@NonNull Bundle bundle, @Nullable String key)
```

Restore action from a bundle using a given key. When isAutoRestore() is true:

- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEditable()` is true: save text of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getTitle()`
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isDescriptionEditable()` is true: save text of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getDescription()`
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getCheckSetId()` is not `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#NO_CHECK_SET()`: save `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isChecked()`}
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction` will be saved

Subclass may override this method.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle` | Bundle to restore the Action from. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html key` | Key used to restore the Action. |

### onSaveInstanceState

```
public void onSaveInstanceState(@NonNull Bundle bundle, @Nullable String key)
```

Save action into a bundle using a given key. When isAutoRestoreEna() is true:

- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isEditable()` is true: save text of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getTitle()`
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isDescriptionEditable()` is true: save text of `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getDescription()`
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#getCheckSetId()` is not `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#NO_CHECK_SET()`: save `https://developer.android.com/reference/androidx/leanback/widget/GuidedAction#isChecked()`}
- `https://developer.android.com/reference/androidx/leanback/widget/GuidedDatePickerAction` will be saved

Subclass may override this method.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle` | Bundle to save the Action. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html key` | Key used to save the Action. |

### setDate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public void setDate(long date)
```

Sets current value of DatePicker in milliseconds since January 1, 1970 00:00:00 in `https://developer.android.com/reference/java/util/TimeZone.html#getDefault()` time zone.

| Parameters |
|---|---|
| `long date` | New value to update current value of DatePicker Action. |