DialogPreference

abstract class DialogPreference : Preference
kotlin.Any
   ↳ 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

abstract

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

Inherited constants

Public constructors

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!)

Public methods

open Drawable!

Returns the icon to be shown on subsequent dialogs.

open Int

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

open CharSequence!

Returns the message to be shown on subsequent dialogs.

open CharSequence!

Returns the title to be shown on subsequent dialogs.

open CharSequence!

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

open CharSequence!

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

open Unit
setDialogIcon(dialogIcon: Drawable!)

Sets the icon of the dialog.

open Unit
setDialogIcon(dialogIconRes: Int)

Sets the icon (resource ID) of the dialog.

open Unit
setDialogLayoutResource(dialogLayoutResId: Int)

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

open Unit
setDialogMessage(dialogMessage: CharSequence!)

Sets the message of the dialog.

open Unit
setDialogMessage(dialogMessageResId: Int)

open Unit

Sets the title of the dialog.

open Unit
setDialogTitle(dialogTitleResId: Int)

open Unit
setNegativeButtonText(negativeButtonText: CharSequence!)

Sets the text of the negative button of the dialog.

open Unit
setNegativeButtonText(negativeButtonTextResId: Int)

open Unit
setPositiveButtonText(positiveButtonText: CharSequence!)

Sets the text of the positive button of the dialog.

open Unit
setPositiveButtonText(positiveButtonTextResId: Int)

Protected methods

open Unit

Inherited functions

Public constructors

<init>

DialogPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

<init>

DialogPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

<init>

DialogPreference(context: Context!, attrs: AttributeSet!)

<init>

DialogPreference(context: Context!)

Public methods

getDialogIcon

open fun getDialogIcon(): Drawable!

Returns the icon to be shown on subsequent dialogs.

Return
Drawable!: The icon, as a Drawable

getDialogLayoutResource

open fun getDialogLayoutResource(): Int

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

Return
Int: The layout resource

getDialogMessage

open fun getDialogMessage(): CharSequence!

Returns the message to be shown on subsequent dialogs.

Return
CharSequence!: The message

getDialogTitle

open fun getDialogTitle(): CharSequence!

Returns the title to be shown on subsequent dialogs.

Return
CharSequence!: The title

getNegativeButtonText

open fun getNegativeButtonText(): CharSequence!

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

Return
CharSequence!: The text of the negative button

getPositiveButtonText

open fun getPositiveButtonText(): CharSequence!

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

Return
CharSequence!: The text of the positive button

setDialogIcon

open fun setDialogIcon(dialogIcon: Drawable!): Unit

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

Parameters
dialogIcon Drawable!: The icon, as a Drawable

setDialogIcon

open fun setDialogIcon(dialogIconRes: Int): Unit

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

Parameters
dialogIconRes Int: The icon, as a resource ID

setDialogLayoutResource

open fun setDialogLayoutResource(dialogLayoutResId: Int): Unit

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

open fun setDialogMessage(dialogMessage: CharSequence!): Unit

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 android.widget.TextView with ID android.R.id#message and it will be populated with this message.

Parameters
dialogMessage CharSequence!: The message

setDialogMessage

open fun setDialogMessage(dialogMessageResId: Int): Unit
Parameters
dialogMessageResId Int: The dialog message as a resource

setDialogTitle

open fun setDialogTitle(dialogTitle: CharSequence!): Unit

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

Parameters
dialogTitle CharSequence!: The title

setDialogTitle

open fun setDialogTitle(dialogTitleResId: Int): Unit
Parameters
dialogTitleResId Int: The dialog title as a resource

setNegativeButtonText

open fun setNegativeButtonText(negativeButtonText: CharSequence!): Unit

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

open fun setNegativeButtonText(negativeButtonTextResId: Int): Unit
Parameters
negativeButtonTextResId Int: The negative button text as a resource

setPositiveButtonText

open fun setPositiveButtonText(positiveButtonText: CharSequence!): Unit

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

setPositiveButtonText

open fun setPositiveButtonText(positiveButtonTextResId: Int): Unit
Parameters
positiveButtonTextResId Int: The positive button text as a resource

Protected methods

onClick

protected open fun onClick(): Unit