DialogPreference
abstract classDialogPreference: Preference, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, PreferenceManager.OnActivityDestroyListener
kotlin.Any | ||
↳ | android.preference.Preference | |
↳ | android.preference.DialogPreference |
A base class for Preference
objects that are dialog-based. These preferences will, when clicked, open a dialog showing the actual preference controls.
Summary
XML attributes | |
---|---|
android:dialogIcon |
The icon for the dialog. |
android:dialogLayout |
A layout to be used as the content View for the dialog. |
android:dialogMessage |
The message in the dialog. |
android:dialogTitle |
The title in the dialog. |
android:negativeButtonText |
The negative button text for the dialog. |
android:positiveButtonText |
The positive button text for the dialog. |
Inherited XML attributes | |
---|---|
Inherited constants | |
---|---|
Public constructors | |
---|---|
DialogPreference(context: Context!) |
|
DialogPreference(context: Context!, attrs: AttributeSet!) |
|
DialogPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int) |
|
DialogPreference(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int) |
Public methods | |
---|---|
open Dialog! |
Gets the dialog that is shown by this preference. |
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 |
See Activity's onDestroy. |
open Unit |
onClick(dialog: DialogInterface!, which: Int) |
open Unit |
onDismiss(dialog: DialogInterface!) |
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 |
open Unit |
setDialogMessage(dialogMessageResId: Int) |
open Unit |
setDialogMessage(dialogMessage: CharSequence!) Sets the message of the dialog. |
open Unit |
setDialogTitle(dialogTitleResId: Int) |
open Unit |
setDialogTitle(dialogTitle: CharSequence!) Sets the title of the dialog. |
open Unit |
setNegativeButtonText(negativeButtonTextResId: Int) |
open Unit |
setNegativeButtonText(negativeButtonText: CharSequence!) Sets the text of the negative button of the dialog. |
open Unit |
setPositiveButtonText(positiveButtonTextResId: Int) |
open Unit |
setPositiveButtonText(positiveButtonText: CharSequence!) Sets the text of the positive button of the dialog. |
Protected methods | |
---|---|
open Unit |
onBindDialogView(view: View!) Binds views in the content View of the dialog to data. |
open Unit |
onClick() |
open View! |
Creates the content view for the dialog (if a custom content view is required). |
open Unit |
onDialogClosed(positiveResult: Boolean) Called when the dialog is dismissed and should be used to save data to the |
open Unit |
onPrepareDialogBuilder(builder: AlertDialog.Builder!) Prepares the dialog builder to be shown when the preference is clicked. |
open Unit |
onRestoreInstanceState(state: Parcelable!) |
open Parcelable! | |
open Unit |
showDialog(state: Bundle!) Shows the dialog associated with this Preference. |
Inherited functions | |
---|---|
XML attributes
android:dialogIcon
android:dialogIcon
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:dialogLayout
android:dialogLayout
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:dialogMessage
android:dialogMessage
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:dialogTitle
android:dialogTitle
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:negativeButtonText
android:negativeButtonText
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:positiveButtonText
android:positiveButtonText
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
Public constructors
DialogPreference
DialogPreference(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int)
DialogPreference
DialogPreference(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int,
defStyleRes: Int)
Public methods
getDialog
open fungetDialog(): Dialog!
Deprecated: Deprecated in Java.
Gets the dialog that is shown by this preference.
Return | |
---|---|
Dialog! |
The dialog, or null if a dialog is not being shown. |
getDialogIcon
open fungetDialogIcon(): Drawable!
Deprecated: Deprecated in Java.
Returns the icon to be shown on subsequent dialogs.
Return | |
---|---|
Drawable! |
The icon, as a Drawable . |
getDialogLayoutResource
open fungetDialogLayoutResource(): Int
Deprecated: Deprecated in Java.
Returns the layout resource that is used as the content View for subsequent dialogs.
Return | |
---|---|
Int |
The layout resource. |
getDialogMessage
open fungetDialogMessage(): CharSequence!
Deprecated: Deprecated in Java.
Returns the message to be shown on subsequent dialogs.
Return | |
---|---|
CharSequence! |
The message. |
getDialogTitle
open fungetDialogTitle(): CharSequence!
Deprecated: Deprecated in Java.
Returns the title to be shown on subsequent dialogs.
Return | |
---|---|
CharSequence! |
The title. |
getNegativeButtonText
open fungetNegativeButtonText(): CharSequence!
Deprecated: Deprecated in Java.
Returns the text of the negative button to be shown on subsequent dialogs.
Return | |
---|---|
CharSequence! |
The text of the negative button. |
getPositiveButtonText
open fungetPositiveButtonText(): CharSequence!
Deprecated: Deprecated in Java.
Returns the text of the positive button to be shown on subsequent dialogs.
Return | |
---|---|
CharSequence! |
The text of the positive button. |
onActivityDestroy
open funonActivityDestroy(): Unit
Deprecated: Deprecated in Java.
See Activity's onDestroy.
onClick
open funonClick(
dialog: DialogInterface!,
which: Int
): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
dialog |
DialogInterface!: the dialog that received the click |
which |
Int: the button that was clicked (ex. DialogInterface.BUTTON_POSITIVE ) or the position of the item clicked |
onDismiss
open funonDismiss(dialog: DialogInterface!): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
dialog |
DialogInterface!: the dialog that was dismissed will be passed into the method |
setDialogIcon
open funsetDialogIcon(dialogIcon: Drawable!): Unit
Deprecated: Deprecated in Java.
Sets the icon of the dialog. This will be shown on subsequent dialogs.
Parameters | |
---|---|
dialogIcon |
Drawable!: The icon, as a Drawable . |
setDialogIcon
open funsetDialogIcon(dialogIconRes: Int): Unit
Deprecated: Deprecated in Java.
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 funsetDialogLayoutResource(dialogLayoutResId: Int): Unit
Deprecated: Deprecated in Java.
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. |
See Also
setDialogMessage
open funsetDialogMessage(dialogMessageResId: Int): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
dialogMessageResId |
Int: The dialog message as a resource. |
See Also
setDialogMessage
open funsetDialogMessage(dialogMessage: CharSequence!): Unit
Deprecated: Deprecated in Java.
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 android.R.id#message
and it will be populated with this message.
Parameters | |
---|---|
dialogMessage |
CharSequence!: The message. |
setDialogTitle
open funsetDialogTitle(dialogTitleResId: Int): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
dialogTitleResId |
Int: The dialog title as a resource. |
See Also
setDialogTitle
open funsetDialogTitle(dialogTitle: CharSequence!): Unit
Deprecated: Deprecated in Java.
Sets the title of the dialog. This will be shown on subsequent dialogs.
Parameters | |
---|---|
dialogTitle |
CharSequence!: The title. |
setNegativeButtonText
open funsetNegativeButtonText(negativeButtonTextResId: Int): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
negativeButtonTextResId |
Int: The negative button text as a resource. |
See Also
setNegativeButtonText
open funsetNegativeButtonText(negativeButtonText: CharSequence!): Unit
Deprecated: Deprecated in Java.
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. |
setPositiveButtonText
open funsetPositiveButtonText(positiveButtonTextResId: Int): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
positiveButtonTextResId |
Int: The positive button text as a resource. |
See Also
setPositiveButtonText
open funsetPositiveButtonText(positiveButtonText: CharSequence!): Unit
Deprecated: Deprecated in Java.
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
onBindDialogView
protected open funonBindDialogView(view: View!): Unit
Deprecated: Deprecated in Java.
Binds views in the content View of the dialog to data.
Make sure to call through to the superclass implementation.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
view |
View!: The content View of the dialog, if it is custom. |
onCreateDialogView
protected open funonCreateDialogView(): View!
Deprecated: Deprecated in Java.
Creates the content view for the dialog (if a custom content view is required). By default, it inflates the dialog layout resource if it is set.
Return | |
---|---|
View! |
The content View for the dialog. |
See Also
onDialogClosed
protected open funonDialogClosed(positiveResult: Boolean): Unit
Deprecated: Deprecated in Java.
Called when the dialog is dismissed and should be used to save data to the SharedPreferences
.
Parameters | |
---|---|
positiveResult |
Boolean: Whether the positive button was clicked (true), or the negative button was clicked or the dialog was canceled (false). |
onPrepareDialogBuilder
protected open funonPrepareDialogBuilder(builder: AlertDialog.Builder!): Unit
Deprecated: Deprecated in Java.
Prepares the dialog builder to be shown when the preference is clicked. Use this to set custom properties on the dialog.
Do not AlertDialog.Builder.create()
or AlertDialog.Builder.show()
.
onRestoreInstanceState
protected open funonRestoreInstanceState(state: Parcelable!): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
state |
Parcelable!: The saved state that had previously been returned by onSaveInstanceState . |
onSaveInstanceState
protected open funonSaveInstanceState(): Parcelable!
Deprecated: Deprecated in Java.
Return | |
---|---|
Parcelable! |
A Parcelable object containing the current dynamic state of this Preference, or null if there is nothing interesting to save. The default implementation returns null . |
showDialog
protected open funshowDialog(state: Bundle!): Unit
Deprecated: Deprecated in Java.
Shows the dialog associated with this Preference. This is normally initiated automatically on clicking on the preference. Call this method if you need to show the dialog on some other event.
Parameters | |
---|---|
state |
Bundle!: Optional instance state to restore on the dialog |