Added in API level 1
Deprecated in API level 29

EditTextPreference


open class EditTextPreference : DialogPreference
kotlin.Any
   ↳ android.preference.Preference
   ↳ android.preference.DialogPreference
   ↳ android.preference.EditTextPreference

A Preference that allows for string input.

It is a subclass of DialogPreference and shows the EditText in a dialog. This EditText can be modified either programmatically via getEditText(), or through XML by setting any EditText attributes on the EditTextPreference.

This preference will store a string into the SharedPreferences.

See EditText Attributes.

Summary

Inherited XML attributes
Inherited constants
Public constructors

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

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

Public methods
open EditText!

Returns the EditText widget that will be shown in the dialog.

open String!

Gets the text from the SharedPreferences.

open Unit
setText(text: String!)

Saves the text to the SharedPreferences.

open Boolean

Checks whether this preference's dependents should currently be disabled.

Protected methods
open Unit
onAddEditTextToDialogView(dialogView: View!, editText: EditText!)

Adds the EditText widget of this preference to the dialog's view.

open Unit

Binds views in the content View of the dialog to data.

open Unit
onDialogClosed(positiveResult: Boolean)

Called when the dialog is dismissed and should be used to save data to the SharedPreferences.

open Any!

Called when a Preference is being inflated and the default value attribute needs to be read.

open Unit

Hook allowing a Preference to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState.

open Parcelable!

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.

open Unit
onSetInitialValue(restoreValue: Boolean, defaultValue: Any!)

Implement this to set the initial value of the Preference.

open Unit
showDialog(state: Bundle!)

Shows the dialog associated with this Preference.

Inherited functions