added in version 24.1.0
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1

DialogPreference

public abstract class DialogPreference
extends Preference

java.lang.Object
   ↳ android.support.v7.preference.Preference
     ↳ android.support.v7.preference.DialogPreference
Known Direct Subclasses
Known Indirect Subclasses


A base class for 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

 

Inherited XML attributes

From class android.support.v7.preference.Preference

Inherited constants

From class android.support.v7.preference.Preference

Public constructors

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

Public methods

Drawable getDialogIcon()

Returns the icon to be shown on subsequent dialogs.

int getDialogLayoutResource()

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

CharSequence getDialogMessage()

Returns the message to be shown on subsequent dialogs.

CharSequence getDialogTitle()

Returns the title to be shown on subsequent dialogs.

CharSequence getNegativeButtonText()

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

CharSequence getPositiveButtonText()

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

void setDialogIcon(int dialogIconRes)

Sets the icon (resource ID) of the dialog.

void setDialogIcon(Drawable dialogIcon)

Sets the icon of the dialog.

void setDialogLayoutResource(int dialogLayoutResId)

Sets the layout resource that is inflated as the View to be shown as the content View of subsequent dialogs.

void setDialogMessage(CharSequence dialogMessage)

Sets the message of the dialog.

void setDialogMessage(int dialogMessageResId)
void setDialogTitle(int dialogTitleResId)
void setDialogTitle(CharSequence dialogTitle)

Sets the title of the dialog.

void setNegativeButtonText(CharSequence negativeButtonText)

Sets the text of the negative button of the dialog.

void setNegativeButtonText(int negativeButtonTextResId)
void setPositiveButtonText(int positiveButtonTextResId)
void setPositiveButtonText(CharSequence positiveButtonText)

Sets the text of the positive button of the dialog.

Protected methods

void onClick()

Processes a click on the preference.

Inherited methods

From class android.support.v7.preference.Preference
From class java.lang.Object
From interface java.lang.Comparable

Public constructors

DialogPreference

added in version 24.1.0
DialogPreference (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

DialogPreference

added in version 24.1.0
DialogPreference (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

DialogPreference

added in version 24.1.0
DialogPreference (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

DialogPreference

added in version 24.1.0
DialogPreference (Context context)

Parameters
context Context

Public methods

getDialogIcon

added in version 24.1.0
Drawable getDialogIcon ()

Returns the icon to be shown on subsequent dialogs.

Returns
Drawable The icon, as a Drawable.

getDialogLayoutResource

added in version 24.1.0
int getDialogLayoutResource ()

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

Returns
int The layout resource.

getDialogMessage

added in version 24.1.0
CharSequence getDialogMessage ()

Returns the message to be shown on subsequent dialogs.

Returns
CharSequence The message.

getDialogTitle

added in version 24.1.0
CharSequence getDialogTitle ()

Returns the title to be shown on subsequent dialogs.

Returns
CharSequence The title.

getNegativeButtonText

added in version 24.1.0
CharSequence getNegativeButtonText ()

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

Returns
CharSequence The text of the negative button.

getPositiveButtonText

added in version 24.1.0
CharSequence getPositiveButtonText ()

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

Returns
CharSequence The text of the positive button.

setDialogIcon

added in version 24.1.0
void setDialogIcon (int dialogIconRes)

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

Parameters
dialogIconRes int: The icon, as a resource ID.

setDialogIcon

added in version 24.1.0
void setDialogIcon (Drawable dialogIcon)

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

Parameters
dialogIcon Drawable: The icon, as a Drawable.

setDialogLayoutResource

added in version 24.1.0
void setDialogLayoutResource (int dialogLayoutResId)

Sets the layout resource that is inflated as the View to be shown as the content View of subsequent dialogs.

Parameters
dialogLayoutResId int: The layout resource ID to be inflated.

setDialogMessage

added in version 24.1.0
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), include a text View with ID message and it will be populated with this message.

Parameters
dialogMessage CharSequence: The message.

setDialogMessage

added in version 24.1.0
void setDialogMessage (int dialogMessageResId)

Parameters
dialogMessageResId int: The dialog message as a resource.

setDialogTitle

added in version 24.1.0
void setDialogTitle (int dialogTitleResId)

Parameters
dialogTitleResId int: The dialog title as a resource.

setDialogTitle

added in version 24.1.0
void setDialogTitle (CharSequence dialogTitle)

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

Parameters
dialogTitle CharSequence: The title.

setNegativeButtonText

added in version 24.1.0
void setNegativeButtonText (CharSequence negativeButtonText)

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

Parameters
negativeButtonText CharSequence: The text of the negative button.

setNegativeButtonText

added in version 24.1.0
void setNegativeButtonText (int negativeButtonTextResId)

Parameters
negativeButtonTextResId int: The negative button text as a resource.

setPositiveButtonText

added in version 24.1.0
void setPositiveButtonText (int positiveButtonTextResId)

Parameters
positiveButtonTextResId int: The positive button text as a resource.

setPositiveButtonText

added in version 24.1.0
void setPositiveButtonText (CharSequence positiveButtonText)

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

Parameters
positiveButtonText CharSequence: The text of the positive button.

Protected methods

onClick

added in version 24.1.0
void onClick ()

Processes a click on the preference. This includes saving the value to the SharedPreferences. However, the overridden method should call callChangeListener(Object) to make sure the client wants to update the preference's state with the new value.