# DialogPreference

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1  
Summary:[Nested Classes](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#nestedclasses)\|[Inherited XML Attrs](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#inhattrs)\|[Inherited Constants](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#inhconstants)\|[Ctors](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)  

# DialogPreference

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


abstract
class
DialogPreference
`  
`


``

extends `[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)`


``


`

|---|---|------------------------------------------------|
| java.lang.Object                                     |||
| ↳ | [android.support.v7.preference.Preference](https://developer.android.com/reference/android/support/v7/preference/Preference) ||
|   | ↳ | android.support.v7.preference.DialogPreference |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)Known Direct Subclasses [EditTextPreference](https://developer.android.com/reference/android/support/v7/preference/EditTextPreference),[ListPreference](https://developer.android.com/reference/android/support/v7/preference/ListPreference),[MultiSelectListPreference](https://developer.android.com/reference/android/support/v14/preference/MultiSelectListPreference) |-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------| | [EditTextPreference](https://developer.android.com/reference/android/support/v7/preference/EditTextPreference)                | A[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)that allows for string input.                | | [ListPreference](https://developer.android.com/reference/android/support/v7/preference/ListPreference)                        | A[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)that displays a list of entries as a dialog. | | [MultiSelectListPreference](https://developer.android.com/reference/android/support/v14/preference/MultiSelectListPreference) | A[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)that displays a list of entries as a dialog. | |

|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)Known Indirect Subclasses [DropDownPreference](https://developer.android.com/reference/android/support/v7/preference/DropDownPreference) |----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [DropDownPreference](https://developer.android.com/reference/android/support/v7/preference/DropDownPreference) | A version of[ListPreference](https://developer.android.com/reference/android/support/v7/preference/ListPreference)that presents the options in a drop down menu rather than a dialog. | ||

<br />

*** ** * ** ***

A base class for[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)objects that are dialog-based. These preferences will, when clicked, open a dialog showing the actual preference controls.

## Summary

|                                                                      ### Nested classes                                                                       ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [DialogPreference.TargetFragment](https://developer.android.com/reference/android/support/v7/preference/DialogPreference.TargetFragment) <br /> |

| ### Inherited XML attributes |
|------------------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)From class` `[android.support.v7.preference.Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` ` |----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---| | [`Preference_android_iconSpaceReserved`](https://developer.android.com/reference/android/support/v7/preference/Preference#attr_Preference_android_iconSpaceReserved) |   | | [`Preference_android_singleLineTitle`](https://developer.android.com/reference/android/support/v7/preference/Preference#attr_Preference_android_singleLineTitle)     |   | ||

|                                                                                                                                                                                                                                                                                                                                                                                                                                             ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)From class` `[android.support.v7.preference.Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` ` |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [DEFAULT_ORDER](https://developer.android.com/reference/android/support/v7/preference/Preference#DEFAULT_ORDER) Specify for[setOrder(int)](https://developer.android.com/reference/android/support/v7/preference/Preference#setOrder(int))if a specific order is not required. | |

|                                                                                                                                                                                                     ### Public constructors                                                                                                                                                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[DialogPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#DialogPreference(android.content.Context, android.util.AttributeSet, int, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs, int defStyleAttr, int defStyleRes) ` |
| ` `[DialogPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#DialogPreference(android.content.Context, android.util.AttributeSet, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs, int defStyleAttr) `                       |
| ` `[DialogPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#DialogPreference(android.content.Context, android.util.AttributeSet))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` attrs) `                                              |
| ` `[DialogPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#DialogPreference(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) `                                                                                                                                                                         |

|                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                    ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | ` `[getDialogIcon](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getDialogIcon())`() ` Returns the icon to be shown on subsequent dialogs.                                                                                                                                                                      |
| ` int`                                                                                         | ` `[getDialogLayoutResource](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getDialogLayoutResource())`() ` Returns the layout resource that is used as the content View for subsequent dialogs.                                                                                                                 |
| ` CharSequence`                                                                                | ` `[getDialogMessage](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getDialogMessage())`() ` Returns the message to be shown on subsequent dialogs.                                                                                                                                                             |
| ` CharSequence`                                                                                | ` `[getDialogTitle](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getDialogTitle())`() ` Returns the title to be shown on subsequent dialogs.                                                                                                                                                                   |
| ` CharSequence`                                                                                | ` `[getNegativeButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getNegativeButtonText())`() ` Returns the text of the negative button to be shown on subsequent dialogs.                                                                                                                               |
| ` CharSequence`                                                                                | ` `[getPositiveButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#getPositiveButtonText())`() ` Returns the text of the positive button to be shown on subsequent dialogs.                                                                                                                               |
| ` void`                                                                                        | ` `[setDialogIcon](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogIcon(int))`(int dialogIconRes) ` Sets the icon (resource ID) of the dialog.                                                                                                                                                           |
| ` void`                                                                                        | ` `[setDialogIcon](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogIcon(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` dialogIcon) ` Sets the icon of the dialog.                                                   |
| ` void`                                                                                        | ` `[setDialogLayoutResource](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogLayoutResource(int))`(int dialogLayoutResId) ` Sets the layout resource that is inflated as the[View](https://developer.android.com/reference/android/view/View.html)to be shown as the content View of subsequent dialogs. |
| ` void`                                                                                        | ` `[setDialogMessage](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogMessage(java.lang.CharSequence))`(CharSequence dialogMessage) ` Sets the message of the dialog.                                                                                                                                    |
| ` void`                                                                                        | ` `[setDialogMessage](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogMessage(int))`(int dialogMessageResId) `                                                                                                                                                                                           |
| ` void`                                                                                        | ` `[setDialogTitle](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogTitle(int))`(int dialogTitleResId) `                                                                                                                                                                                                 |
| ` void`                                                                                        | ` `[setDialogTitle](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogTitle(java.lang.CharSequence))`(CharSequence dialogTitle) ` Sets the title of the dialog.                                                                                                                                            |
| ` void`                                                                                        | ` `[setNegativeButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setNegativeButtonText(java.lang.CharSequence))`(CharSequence negativeButtonText) ` Sets the text of the negative button of the dialog.                                                                                                 |
| ` void`                                                                                        | ` `[setNegativeButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setNegativeButtonText(int))`(int negativeButtonTextResId) `                                                                                                                                                                            |
| ` void`                                                                                        | ` `[setPositiveButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setPositiveButtonText(int))`(int positiveButtonTextResId) `                                                                                                                                                                            |
| ` void`                                                                                        | ` `[setPositiveButtonText](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setPositiveButtonText(java.lang.CharSequence))`(CharSequence positiveButtonText) ` Sets the text of the positive button of the dialog.                                                                                                 |

|                                                                       ### Protected methods                                                                       ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onClick](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#onClick())`() ` Processes a click on the preference. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)From class` `[android.support.v7.preference.Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` ` |---------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` boolean`                                                                                                                                              | ` `[callChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference#callChangeListener(java.lang.Object))`(Object newValue) ` Call this method after the user changes the preference, but before the internal state is set.                                                                                                                                                                                                                                                                                                                                  | | ` int`                                                                                                                                                  | ` `[compareTo](https://developer.android.com/reference/android/support/v7/preference/Preference#compareTo(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` another) ` Compares Preference objects based on order (if set), otherwise alphabetically on the titles.                                                                                                                                                                                                                                    | | ` `[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)                                                       | ` `[findPreferenceInHierarchy](https://developer.android.com/reference/android/support/v7/preference/Preference#findPreferenceInHierarchy(java.lang.String))`(String key) ` Finds a Preference in this hierarchy (the whole thing, even above/below your[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)screen break) with the given key.                                                                                                                                                                                               | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                                                                      | ` `[getContext](https://developer.android.com/reference/android/support/v7/preference/Preference#getContext())`() ` Returns the[Context](https://developer.android.com/reference/android/content/Context.html)of this Preference.                                                                                                                                                                                                                                                                                                                                                                 | | ` String`                                                                                                                                               | ` `[getDependency](https://developer.android.com/reference/android/support/v7/preference/Preference#getDependency())`() ` Returns the key of the dependency on this Preference.                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                             | ` `[getExtras](https://developer.android.com/reference/android/support/v7/preference/Preference#getExtras())`() ` Return the extras Bundle object associated with this preference, creating a new Bundle if there currently isn't one.                                                                                                                                                                                                                                                                                                                                                            | | ` String`                                                                                                                                               | ` `[getFragment](https://developer.android.com/reference/android/support/v7/preference/Preference#getFragment())`() ` Return the fragment class name associated with this Preference.                                                                                                                                                                                                                                                                                                                                                                                                             | | ` `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)                                                          | ` `[getIcon](https://developer.android.com/reference/android/support/v7/preference/Preference#getIcon())`() ` Returns the icon of this Preference.                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Intent](https://developer.android.com/reference/android/content/Intent.html)                                                                        | ` `[getIntent](https://developer.android.com/reference/android/support/v7/preference/Preference#getIntent())`() ` Return the[Intent](https://developer.android.com/reference/android/content/Intent.html)associated with this Preference.                                                                                                                                                                                                                                                                                                                                                         | | ` String`                                                                                                                                               | ` `[getKey](https://developer.android.com/reference/android/support/v7/preference/Preference#getKey())`() ` Gets the key for this Preference, which is also the key used for storing values into[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)or[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore).                                                                                                                                                                            | | ` final int`                                                                                                                                            | ` `[getLayoutResource](https://developer.android.com/reference/android/support/v7/preference/Preference#getLayoutResource())`() ` Gets the layout resource that will be shown as the[View](https://developer.android.com/reference/android/view/View.html)for this Preference.                                                                                                                                                                                                                                                                                                                    | | ` `[Preference.OnPreferenceChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceChangeListener) | ` `[getOnPreferenceChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference#getOnPreferenceChangeListener())`() ` Returns the callback to be invoked when this Preference is changed by the user (but before the internal state has been updated).                                                                                                                                                                                                                                                                                                        | | ` `[Preference.OnPreferenceClickListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceClickListener)   | ` `[getOnPreferenceClickListener](https://developer.android.com/reference/android/support/v7/preference/Preference#getOnPreferenceClickListener())`() ` Returns the callback to be invoked when this Preference is clicked.                                                                                                                                                                                                                                                                                                                                                                       | | ` int`                                                                                                                                                  | ` `[getOrder](https://developer.android.com/reference/android/support/v7/preference/Preference#getOrder())`() ` Gets the order of this Preference with respect to other Preference objects on the same level.                                                                                                                                                                                                                                                                                                                                                                                     | | ` `[PreferenceGroup](https://developer.android.com/reference/android/support/v7/preference/PreferenceGroup)                                             | ` `[getParent](https://developer.android.com/reference/android/support/v7/preference/Preference#getParent())`() ` Returns the[PreferenceGroup](https://developer.android.com/reference/android/support/v7/preference/PreferenceGroup)which is this Preference assigned to or null if this preference is not assigned to any group or is a root Preference.                                                                                                                                                                                                                                        | | ` boolean`                                                                                                                                              | ` `[getPersistedBoolean](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedBoolean(boolean))`(boolean defaultReturnValue) ` Attempts to get a persisted[Boolean](https://developer.android.com/reference/java/lang/Boolean)if this Preference is persistent.                                                                                                                                                                                                                                                                                           | | ` float`                                                                                                                                                | ` `[getPersistedFloat](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedFloat(float))`(float defaultReturnValue) ` Attempts to get a persisted[Float](https://developer.android.com/reference/java/lang/Float)if this Preference is persistent.                                                                                                                                                                                                                                                                                                       | | ` int`                                                                                                                                                  | ` `[getPersistedInt](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedInt(int))`(int defaultReturnValue) ` Attempts to get a persisted[Integer](https://developer.android.com/reference/java/lang/Integer)if this Preference is persistent.                                                                                                                                                                                                                                                                                                           | | ` long`                                                                                                                                                 | ` `[getPersistedLong](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedLong(long))`(long defaultReturnValue) ` Attempts to get a persisted[Long](https://developer.android.com/reference/java/lang/Long)if this Preference is persistent.                                                                                                                                                                                                                                                                                                             | | ` String`                                                                                                                                               | ` `[getPersistedString](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedString(java.lang.String))`(String defaultReturnValue) ` Attempts to get a persisted set of Strings if this Preference is persistent.                                                                                                                                                                                                                                                                                                                                         | | ` Set<String>`                                                                                                                                          | ` `[getPersistedStringSet](https://developer.android.com/reference/android/support/v7/preference/Preference#getPersistedStringSet(java.util.Set<java.lang.String>))`(Set<String> defaultReturnValue) ` Attempts to get a persisted set of Strings if this Preference is persistent.                                                                                                                                                                                                                                                                                                               | | ` `[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)                                     | ` `[getPreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/Preference#getPreferenceDataStore())`() ` Returns[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)used by this Preference.                                                                                                                                                                                                                                                                                                       | | ` `[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)                                         | ` `[getPreferenceManager](https://developer.android.com/reference/android/support/v7/preference/Preference#getPreferenceManager())`() ` Gets the[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)that manages this Preference object's tree.                                                                                                                                                                                                                                                                                           | | ` `[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)                                                  | ` `[getSharedPreferences](https://developer.android.com/reference/android/support/v7/preference/Preference#getSharedPreferences())`() ` Returns the[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)where this Preference can read its value(s).                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                                              | ` `[getShouldDisableView](https://developer.android.com/reference/android/support/v7/preference/Preference#getShouldDisableView())`() ` Checks whether this Preference should disable its view when it's action is disabled.                                                                                                                                                                                                                                                                                                                                                                      | | ` CharSequence`                                                                                                                                         | ` `[getSummary](https://developer.android.com/reference/android/support/v7/preference/Preference#getSummary())`() ` Returns the summary of this Preference.                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` CharSequence`                                                                                                                                         | ` `[getTitle](https://developer.android.com/reference/android/support/v7/preference/Preference#getTitle())`() ` Returns the title of this Preference.                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` final int`                                                                                                                                            | ` `[getWidgetLayoutResource](https://developer.android.com/reference/android/support/v7/preference/Preference#getWidgetLayoutResource())`() ` Gets the layout resource for the controllable widget portion of this Preference.                                                                                                                                                                                                                                                                                                                                                                    | | ` boolean`                                                                                                                                              | ` `[hasKey](https://developer.android.com/reference/android/support/v7/preference/Preference#hasKey())`() ` Checks whether this Preference has a valid key.                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` boolean`                                                                                                                                              | ` `[isEnabled](https://developer.android.com/reference/android/support/v7/preference/Preference#isEnabled())`() ` Checks whether this Preference should be enabled in the list.                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                                              | ` `[isIconSpaceReserved](https://developer.android.com/reference/android/support/v7/preference/Preference#isIconSpaceReserved())`() ` Returns whether the space of this preference icon view is reserved.                                                                                                                                                                                                                                                                                                                                                                                         | | ` boolean`                                                                                                                                              | ` `[isPersistent](https://developer.android.com/reference/android/support/v7/preference/Preference#isPersistent())`() ` Checks whether this Preference is persistent.                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` boolean`                                                                                                                                              | ` `[isSelectable](https://developer.android.com/reference/android/support/v7/preference/Preference#isSelectable())`() ` Checks whether this Preference should be selectable in the list.                                                                                                                                                                                                                                                                                                                                                                                                          | | ` boolean`                                                                                                                                              | ` `[isSingleLineTitle](https://developer.android.com/reference/android/support/v7/preference/Preference#isSingleLineTitle())`() ` Gets whether the title of this preference is constrained to a single line.                                                                                                                                                                                                                                                                                                                                                                                      | | ` final boolean`                                                                                                                                        | ` `[isVisible](https://developer.android.com/reference/android/support/v7/preference/Preference#isVisible())`() ` Checks whether this preference should be visible to the user in the list.                                                                                                                                                                                                                                                                                                                                                                                                       | | ` void`                                                                                                                                                 | ` `[notifyChanged](https://developer.android.com/reference/android/support/v7/preference/Preference#notifyChanged())`() ` Should be called when the data of this[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)has changed.                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                                                 | ` `[notifyDependencyChange](https://developer.android.com/reference/android/support/v7/preference/Preference#notifyDependencyChange(boolean))`(boolean disableDependents) ` Notifies any listening dependents of a change that affects the dependency.                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                                                 | ` `[notifyHierarchyChanged](https://developer.android.com/reference/android/support/v7/preference/Preference#notifyHierarchyChanged())`() ` Should be called when a Preference has been added/removed from this group, or the ordering should be re-evaluated.                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                                                 | ` `[onAttached](https://developer.android.com/reference/android/support/v7/preference/Preference#onAttached())`() ` Called when the Preference hierarchy has been attached to the list of preferences.                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                                                 | ` `[onAttachedToHierarchy](https://developer.android.com/reference/android/support/v7/preference/Preference#onAttachedToHierarchy(android.support.v7.preference.PreferenceManager))`(`[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)` preferenceManager) ` Called when this Preference has been attached to a Preference hierarchy.                                                                                                                                                                                                 | | ` void`                                                                                                                                                 | ` `[onBindViewHolder](https://developer.android.com/reference/android/support/v7/preference/Preference#onBindViewHolder(android.support.v7.preference.PreferenceViewHolder))`(`[PreferenceViewHolder](https://developer.android.com/reference/android/support/v7/preference/PreferenceViewHolder)` holder) ` Binds the created View to the data for this Preference.                                                                                                                                                                                                                              | | ` void`                                                                                                                                                 | ` `[onClick](https://developer.android.com/reference/android/support/v7/preference/Preference#onClick())`() ` Processes a click on the preference.                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                                                 | ` `[onDependencyChanged](https://developer.android.com/reference/android/support/v7/preference/Preference#onDependencyChanged(android.support.v7.preference.Preference, boolean))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` dependency, boolean disableDependent) ` Called when the dependency changes.                                                                                                                                                                                                                                   | | ` void`                                                                                                                                                 | ` `[onDetached](https://developer.android.com/reference/android/support/v7/preference/Preference#onDetached())`() ` Called when the Preference hierarchy has been detached from the list of preferences.                                                                                                                                                                                                                                                                                                                                                                                          | | ` Object`                                                                                                                                               | ` `[onGetDefaultValue](https://developer.android.com/reference/android/support/v7/preference/Preference#onGetDefaultValue(android.content.res.TypedArray, int))`(`[TypedArray](https://developer.android.com/reference/android/content/res/TypedArray.html)` a, int index) ` Called when a Preference is being inflated and the default value attribute needs to be read.                                                                                                                                                                                                                         | | ` void`                                                                                                                                                 | ` `[onInitializeAccessibilityNodeInfo](https://developer.android.com/reference/android/support/v7/preference/Preference#onInitializeAccessibilityNodeInfo(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat))`(`[AccessibilityNodeInfoCompat](https://developer.android.com/reference/android/support/v4/view/accessibility/AccessibilityNodeInfoCompat)` info) ` Initializes an[AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html)with information about the View for this Preference.                        | | ` void`                                                                                                                                                 | ` `[onParentChanged](https://developer.android.com/reference/android/support/v7/preference/Preference#onParentChanged(android.support.v7.preference.Preference, boolean))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` parent, boolean disableChild) ` Called when the implicit parent dependency changes.                                                                                                                                                                                                                                   | | ` void`                                                                                                                                                 | ` `[onPrepareForRemoval](https://developer.android.com/reference/android/support/v7/preference/Preference#onPrepareForRemoval())`() ` Called when this Preference is being removed from the hierarchy.                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                                                 | ` `[onRestoreInstanceState](https://developer.android.com/reference/android/support/v7/preference/Preference#onRestoreInstanceState(android.os.Parcelable))`(`[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)` state) ` Hook allowing a Preference to re-apply a representation of its internal state that had previously been generated by[onSaveInstanceState()](https://developer.android.com/reference/android/support/v7/preference/Preference#onSaveInstanceState()).                                                                                      | | ` `[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)                                                                     | ` `[onSaveInstanceState](https://developer.android.com/reference/android/support/v7/preference/Preference#onSaveInstanceState())`() ` Hook allowing a Preference to generate a representation of its internal state that can later be used to create a new instance with that same state.                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                                                 | ` `[onSetInitialValue](https://developer.android.com/reference/android/support/v7/preference/Preference#onSetInitialValue(boolean, java.lang.Object))`(boolean restorePersistedValue, Object defaultValue) ` Implement this to set the initial value of the Preference.                                                                                                                                                                                                                                                                                                                           | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                             | ` `[peekExtras](https://developer.android.com/reference/android/support/v7/preference/Preference#peekExtras())`() ` Return the extras Bundle object associated with this preference, returning null if there is not currently one.                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                                              | ` `[persistBoolean](https://developer.android.com/reference/android/support/v7/preference/Preference#persistBoolean(boolean))`(boolean value) ` Attempts to persist a[Boolean](https://developer.android.com/reference/java/lang/Boolean)if this Preference is persistent.                                                                                                                                                                                                                                                                                                                        | | ` boolean`                                                                                                                                              | ` `[persistFloat](https://developer.android.com/reference/android/support/v7/preference/Preference#persistFloat(float))`(float value) ` Attempts to persist a[Float](https://developer.android.com/reference/java/lang/Float)if this Preference is persistent.                                                                                                                                                                                                                                                                                                                                    | | ` boolean`                                                                                                                                              | ` `[persistInt](https://developer.android.com/reference/android/support/v7/preference/Preference#persistInt(int))`(int value) ` Attempts to persist an[Integer](https://developer.android.com/reference/java/lang/Integer)if this Preference is persistent.                                                                                                                                                                                                                                                                                                                                       | | ` boolean`                                                                                                                                              | ` `[persistLong](https://developer.android.com/reference/android/support/v7/preference/Preference#persistLong(long))`(long value) ` Attempts to persist a[Long](https://developer.android.com/reference/java/lang/Long)if this Preference is persistent.                                                                                                                                                                                                                                                                                                                                          | | ` boolean`                                                                                                                                              | ` `[persistString](https://developer.android.com/reference/android/support/v7/preference/Preference#persistString(java.lang.String))`(String value) ` Attempts to persist a[String](https://developer.android.com/reference/java/lang/String)if this Preference is persistent.                                                                                                                                                                                                                                                                                                                    | | ` boolean`                                                                                                                                              | ` `[persistStringSet](https://developer.android.com/reference/android/support/v7/preference/Preference#persistStringSet(java.util.Set<java.lang.String>))`(Set<String> values) ` Attempts to persist a set of Strings if this Preference is persistent.                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                                                 | ` `[restoreHierarchyState](https://developer.android.com/reference/android/support/v7/preference/Preference#restoreHierarchyState(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` container) ` Restore this Preference hierarchy's previously saved state from the given container.                                                                                                                                                                                                                                                               | | ` void`                                                                                                                                                 | ` `[saveHierarchyState](https://developer.android.com/reference/android/support/v7/preference/Preference#saveHierarchyState(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` container) ` Store this Preference hierarchy's frozen state into the given container.                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                                                 | ` `[setDefaultValue](https://developer.android.com/reference/android/support/v7/preference/Preference#setDefaultValue(java.lang.Object))`(Object defaultValue) ` Sets the default value for this Preference, which will be set either if persistence is off or persistence is on and the preference is not found in the persistent storage.                                                                                                                                                                                                                                                       | | ` void`                                                                                                                                                 | ` `[setDependency](https://developer.android.com/reference/android/support/v7/preference/Preference#setDependency(java.lang.String))`(String dependencyKey) ` Sets the key of a Preference that this Preference will depend on.                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                                                 | ` `[setEnabled](https://developer.android.com/reference/android/support/v7/preference/Preference#setEnabled(boolean))`(boolean enabled) ` Sets whether this Preference is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                                                 | ` `[setFragment](https://developer.android.com/reference/android/support/v7/preference/Preference#setFragment(java.lang.String))`(String fragment) ` Sets the class name of a fragment to be shown when this Preference is clicked.                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                                                 | ` `[setIcon](https://developer.android.com/reference/android/support/v7/preference/Preference#setIcon(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` icon) ` Sets the icon for this Preference with a Drawable.                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                                                 | ` `[setIcon](https://developer.android.com/reference/android/support/v7/preference/Preference#setIcon(int))`(int iconResId) ` Sets the icon for this Preference with a resource ID.                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                                                 | ` `[setIconSpaceReserved](https://developer.android.com/reference/android/support/v7/preference/Preference#setIconSpaceReserved(boolean))`(boolean iconSpaceReserved) ` Sets whether to reserve the space of this Preference icon view when no icon is provided.                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                                                 | ` `[setIntent](https://developer.android.com/reference/android/support/v7/preference/Preference#setIntent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) ` Sets an[Intent](https://developer.android.com/reference/android/content/Intent.html)to be used for[startActivity(Intent)](https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent))when this Preference is clicked.                                                                                               | | ` void`                                                                                                                                                 | ` `[setKey](https://developer.android.com/reference/android/support/v7/preference/Preference#setKey(java.lang.String))`(String key) ` Sets the key for this Preference, which is used as a key to the[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)or[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore).                                                                                                                                                                       | | ` void`                                                                                                                                                 | ` `[setLayoutResource](https://developer.android.com/reference/android/support/v7/preference/Preference#setLayoutResource(int))`(int layoutResId) ` Sets the layout resource that is inflated as the[View](https://developer.android.com/reference/android/view/View.html)to be shown for this Preference.                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                                                 | ` `[setOnPreferenceChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference#setOnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener))`(`[Preference.OnPreferenceChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceChangeListener)` onPreferenceChangeListener) ` Sets the callback to be invoked when this Preference is changed by the user (but before the internal state has been updated).                                                       | | ` void`                                                                                                                                                 | ` `[setOnPreferenceClickListener](https://developer.android.com/reference/android/support/v7/preference/Preference#setOnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener))`(`[Preference.OnPreferenceClickListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceClickListener)` onPreferenceClickListener) ` Sets the callback to be invoked when this Preference is clicked.                                                                                                                          | | ` void`                                                                                                                                                 | ` `[setOrder](https://developer.android.com/reference/android/support/v7/preference/Preference#setOrder(int))`(int order) ` Sets the order of this Preference with respect to other Preference objects on the same level.                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                                                 | ` `[setPersistent](https://developer.android.com/reference/android/support/v7/preference/Preference#setPersistent(boolean))`(boolean persistent) ` Sets whether this Preference is persistent.                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                                                 | ` `[setPreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/Preference#setPreferenceDataStore(android.support.v7.preference.PreferenceDataStore))`(`[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)` dataStore) ` Sets a[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)to be used by this Preference instead of using[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html). | | ` void`                                                                                                                                                 | ` `[setSelectable](https://developer.android.com/reference/android/support/v7/preference/Preference#setSelectable(boolean))`(boolean selectable) ` Sets whether this Preference is selectable.                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                                                 | ` `[setShouldDisableView](https://developer.android.com/reference/android/support/v7/preference/Preference#setShouldDisableView(boolean))`(boolean shouldDisableView) ` Sets whether this Preference should disable its view when it gets disabled.                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                                                 | ` `[setSingleLineTitle](https://developer.android.com/reference/android/support/v7/preference/Preference#setSingleLineTitle(boolean))`(boolean singleLineTitle) ` Sets whether to constrain the title of this Preference to a single line instead of letting it wrap onto multiple lines.                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                                                 | ` `[setSummary](https://developer.android.com/reference/android/support/v7/preference/Preference#setSummary(java.lang.CharSequence))`(CharSequence summary) ` Sets the summary for this Preference with a CharSequence.                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                                                 | ` `[setSummary](https://developer.android.com/reference/android/support/v7/preference/Preference#setSummary(int))`(int summaryResId) ` Sets the summary for this Preference with a resource ID.                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                                                 | ` `[setTitle](https://developer.android.com/reference/android/support/v7/preference/Preference#setTitle(java.lang.CharSequence))`(CharSequence title) ` Sets the title for this Preference with a CharSequence.                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                                                 | ` `[setTitle](https://developer.android.com/reference/android/support/v7/preference/Preference#setTitle(int))`(int titleResId) ` Sets the title for this Preference with a resource ID.                                                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                                                 | ` `[setViewId](https://developer.android.com/reference/android/support/v7/preference/Preference#setViewId(int))`(int viewId) ` Set the ID that will be assigned to the overall View representing this preference, once bound.                                                                                                                                                                                                                                                                                                                                                                     | | ` final void`                                                                                                                                           | ` `[setVisible](https://developer.android.com/reference/android/support/v7/preference/Preference#setVisible(boolean))`(boolean visible) ` Sets whether this preference should be visible in the list.                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                                                                                 | ` `[setWidgetLayoutResource](https://developer.android.com/reference/android/support/v7/preference/Preference#setWidgetLayoutResource(int))`(int widgetLayoutResId) ` Sets the layout for the controllable widget portion of this Preference.                                                                                                                                                                                                                                                                                                                                                     | | ` boolean`                                                                                                                                              | ` `[shouldDisableDependents](https://developer.android.com/reference/android/support/v7/preference/Preference#shouldDisableDependents())`() ` Checks whether this preference's dependents should currently be disabled.                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                                              | ` `[shouldPersist](https://developer.android.com/reference/android/support/v7/preference/Preference#shouldPersist())`() ` Checks whether, at the given time this method is called, this Preference should store/restore its value(s) into the[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)or into[PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)if assigned.                                                                                                               | | ` String`                                                                                                                                               | ` `[toString](https://developer.android.com/reference/android/support/v7/preference/Preference#toString())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#)From interface` java.lang.Comparable ` |-----------------|----------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` compareTo(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` arg0) ` | ||

## Public constructors

### DialogPreference

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DialogPreference (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)
```

<br />

<br />

|              Parameters               ||
|----------------|-----------------------|
| `context`      | `Context` <br />      |
| `attrs`        | `AttributeSet` <br /> |
| `defStyleAttr` | `int` <br />          |
| `defStyleRes`  | `int` <br />          |

### DialogPreference

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DialogPreference (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)
```

<br />

<br />

|              Parameters               ||
|----------------|-----------------------|
| `context`      | `Context` <br />      |
| `attrs`        | `AttributeSet` <br /> |
| `defStyleAttr` | `int` <br />          |

### DialogPreference

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DialogPreference (Context context, 
                AttributeSet attrs)
```

<br />

<br />

|            Parameters            ||
|-----------|-----------------------|
| `context` | `Context` <br />      |
| `attrs`   | `AttributeSet` <br /> |

### DialogPreference

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DialogPreference (Context context)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

## Public methods

### getDialogIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Drawable getDialogIcon ()
```

Returns the icon to be shown on subsequent dialogs.

<br />

|                                                                                                    Returns                                                                                                     ||
|---------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The icon, as a[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html). <br /> |

### getDialogLayoutResource

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getDialogLayoutResource ()
```

Returns the layout resource that is used as the content View for subsequent dialogs.

<br />

|              Returns               ||
|-------|-----------------------------|
| `int` | The layout resource. <br /> |

### getDialogMessage

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getDialogMessage ()
```

Returns the message to be shown on subsequent dialogs.

<br />

|               Returns               ||
|----------------|---------------------|
| `CharSequence` | The message. <br /> |

### getDialogTitle

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getDialogTitle ()
```

Returns the title to be shown on subsequent dialogs.

<br />

|              Returns              ||
|----------------|-------------------|
| `CharSequence` | The title. <br /> |

### getNegativeButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getNegativeButtonText ()
```

Returns the text of the negative button to be shown on subsequent dialogs.

<br />

|                         Returns                         ||
|----------------|-----------------------------------------|
| `CharSequence` | The text of the negative button. <br /> |

### getPositiveButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getPositiveButtonText ()
```

Returns the text of the positive button to be shown on subsequent dialogs.

<br />

|                         Returns                         ||
|----------------|-----------------------------------------|
| `CharSequence` | The text of the positive button. <br /> |

### setDialogIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogIcon (int dialogIconRes)
```

Sets the icon (resource ID) of the dialog. This will be shown on subsequent dialogs.

<br />

|                         Parameters                         ||
|-----------------|-------------------------------------------|
| `dialogIconRes` | `int`: The icon, as a resource ID. <br /> |

### setDialogIcon

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogIcon (Drawable dialogIcon)
```

Sets the icon of the dialog. This will be shown on subsequent dialogs.

<br />

|                                                                 Parameters                                                                  ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------|
| `dialogIcon` | `Drawable`: The icon, as a[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html). <br /> |

### setDialogLayoutResource

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogLayoutResource (int dialogLayoutResId)
```

Sets the layout resource that is inflated as the[View](https://developer.android.com/reference/android/view/View.html)to be shown as the content View of subsequent dialogs.

<br />

|                                Parameters                                 ||
|---------------------|------------------------------------------------------|
| `dialogLayoutResId` | `int`: The layout resource ID to be inflated. <br /> |

**See also:**

- [setDialogMessage(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogMessage(java.lang.CharSequence))  

### setDialogMessage

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogMessage (CharSequence dialogMessage)
```

Sets the message of the dialog. This will be shown on subsequent dialogs.

This message forms the content View of the dialog and conflicts with list-based dialogs, for example. If setting a custom View on a dialog via[setDialogLayoutResource(int)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogLayoutResource(int)), include a text View with ID[message](https://developer.android.com/reference/android/R.id#message)and it will be populated with this message.

<br />

|                      Parameters                      ||
|-----------------|-------------------------------------|
| `dialogMessage` | `CharSequence`: The message. <br /> |

### setDialogMessage

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogMessage (int dialogMessageResId)
```

<br />

<br />

|                              Parameters                               ||
|----------------------|-------------------------------------------------|
| `dialogMessageResId` | `int`: The dialog message as a resource. <br /> |

**See also:**

- [setDialogMessage(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogMessage(java.lang.CharSequence))  

### setDialogTitle

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogTitle (int dialogTitleResId)
```

<br />

<br />

|                            Parameters                             ||
|--------------------|-----------------------------------------------|
| `dialogTitleResId` | `int`: The dialog title as a resource. <br /> |

**See also:**

- [setDialogTitle(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setDialogTitle(java.lang.CharSequence))  

### setDialogTitle

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setDialogTitle (CharSequence dialogTitle)
```

Sets the title of the dialog. This will be shown on subsequent dialogs.

<br />

|                    Parameters                    ||
|---------------|-----------------------------------|
| `dialogTitle` | `CharSequence`: The title. <br /> |

### setNegativeButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setNegativeButtonText (CharSequence negativeButtonText)
```

Sets the text of the negative button of the dialog. This will be shown on subsequent dialogs.

<br />

|                                  Parameters                                   ||
|----------------------|---------------------------------------------------------|
| `negativeButtonText` | `CharSequence`: The text of the negative button. <br /> |

### setNegativeButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setNegativeButtonText (int negativeButtonTextResId)
```

<br />

<br />

|                                    Parameters                                    ||
|---------------------------|-------------------------------------------------------|
| `negativeButtonTextResId` | `int`: The negative button text as a resource. <br /> |

**See also:**

- [setNegativeButtonText(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setNegativeButtonText(java.lang.CharSequence))  

### setPositiveButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setPositiveButtonText (int positiveButtonTextResId)
```

<br />

<br />

|                                    Parameters                                    ||
|---------------------------|-------------------------------------------------------|
| `positiveButtonTextResId` | `int`: The positive button text as a resource. <br /> |

**See also:**

- [setPositiveButtonText(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/DialogPreference#setPositiveButtonText(java.lang.CharSequence))  

### setPositiveButtonText

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setPositiveButtonText (CharSequence positiveButtonText)
```

Sets the text of the positive button of the dialog. This will be shown on subsequent dialogs.

<br />

|                                  Parameters                                   ||
|----------------------|---------------------------------------------------------|
| `positiveButtonText` | `CharSequence`: The text of the positive button. <br /> |

## Protected methods

### onClick

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onClick ()
```

Processes a click on the preference. This includes saving the value to the[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html). However, the overridden method should call[callChangeListener(Object)](https://developer.android.com/reference/android/support/v7/preference/Preference#callChangeListener(java.lang.Object))to make sure the client wants to update the preference's state with the new value.

<br />

-

  ## Interfaces

  - [DialogPreference.TargetFragment](https://developer.android.com/reference/android/support/v7/preference/DialogPreference.TargetFragment)
  - [Preference.OnPreferenceChangeListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceChangeListener)
  - [Preference.OnPreferenceClickListener](https://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceClickListener)
  - [PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback)
  - [PreferenceFragmentCompat.OnPreferenceStartFragmentCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceFragmentCompat.OnPreferenceStartFragmentCallback)
  - [PreferenceFragmentCompat.OnPreferenceStartScreenCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceFragmentCompat.OnPreferenceStartScreenCallback)
  - [PreferenceGroup.PreferencePositionCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceGroup.PreferencePositionCallback)
  - [PreferenceManager.OnDisplayPreferenceDialogListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnDisplayPreferenceDialogListener)
  - [PreferenceManager.OnNavigateToScreenListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnNavigateToScreenListener)
  - [PreferenceManager.OnPreferenceTreeClickListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnPreferenceTreeClickListener)
-

  ## Classes

  - [CheckBoxPreference](https://developer.android.com/reference/android/support/v7/preference/CheckBoxPreference)
  - [DialogPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference)
  - [DropDownPreference](https://developer.android.com/reference/android/support/v7/preference/DropDownPreference)
  - [EditTextPreference](https://developer.android.com/reference/android/support/v7/preference/EditTextPreference)
  - [EditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat)
  - [ListPreference](https://developer.android.com/reference/android/support/v7/preference/ListPreference)
  - [ListPreferenceDialogFragmentCompat](https://developer.android.com/reference/android/support/v7/preference/ListPreferenceDialogFragmentCompat)
  - [MultiSelectListPreferenceDialogFragmentCompat](https://developer.android.com/reference/android/support/v7/preference/MultiSelectListPreferenceDialogFragmentCompat)
  - [Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)
  - [Preference.BaseSavedState](https://developer.android.com/reference/android/support/v7/preference/Preference.BaseSavedState)
  - [PreferenceCategory](https://developer.android.com/reference/android/support/v7/preference/PreferenceCategory)
  - [PreferenceDataStore](https://developer.android.com/reference/android/support/v7/preference/PreferenceDataStore)
  - [PreferenceDialogFragmentCompat](https://developer.android.com/reference/android/support/v7/preference/PreferenceDialogFragmentCompat)
  - [PreferenceFragmentCompat](https://developer.android.com/reference/android/support/v7/preference/PreferenceFragmentCompat)
  - [PreferenceGroup](https://developer.android.com/reference/android/support/v7/preference/PreferenceGroup)
  - [PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)
  - [PreferenceManager.PreferenceComparisonCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.PreferenceComparisonCallback)
  - [PreferenceManager.SimplePreferenceComparisonCallback](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.SimplePreferenceComparisonCallback)
  - [PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)
  - [PreferenceViewHolder](https://developer.android.com/reference/android/support/v7/preference/PreferenceViewHolder)
  - [R](https://developer.android.com/reference/android/support/v7/preference/R)
  - [R.anim](https://developer.android.com/reference/android/support/v7/preference/R.anim)
  - [R.attr](https://developer.android.com/reference/android/support/v7/preference/R.attr)
  - [R.bool](https://developer.android.com/reference/android/support/v7/preference/R.bool)
  - [R.color](https://developer.android.com/reference/android/support/v7/preference/R.color)
  - [R.dimen](https://developer.android.com/reference/android/support/v7/preference/R.dimen)
  - [R.drawable](https://developer.android.com/reference/android/support/v7/preference/R.drawable)
  - [R.id](https://developer.android.com/reference/android/support/v7/preference/R.id)
  - [R.integer](https://developer.android.com/reference/android/support/v7/preference/R.integer)
  - [R.layout](https://developer.android.com/reference/android/support/v7/preference/R.layout)
  - [R.string](https://developer.android.com/reference/android/support/v7/preference/R.string)
  - [R.style](https://developer.android.com/reference/android/support/v7/preference/R.style)
  - [R.styleable](https://developer.android.com/reference/android/support/v7/preference/R.styleable)
  - [SeekBarPreference](https://developer.android.com/reference/android/support/v7/preference/SeekBarPreference)
  - [SwitchPreferenceCompat](https://developer.android.com/reference/android/support/v7/preference/SwitchPreferenceCompat)
  - [TwoStatePreference](https://developer.android.com/reference/android/support/v7/preference/TwoStatePreference)