DialogPreference

public abstract class DialogPreference
extends Preference

java.lang.Object
   ↳ androidx.preference.Preference
     ↳ androidx.preference.DialogPreference


A base class for Preferences that are dialog-based. When clicked, these preferences will open a dialog showing the actual preference controls.

Summary

Nested classes

interface DialogPreference.TargetFragment

Interface for PreferenceFragmentCompats to implement to allow DialogPreferences to find the preference that launched the dialog. 

Inherited constants

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