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
<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 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

Protected methods
open Parcelable!

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

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

open Unit

open Any!

open Unit

open Unit
onDialogClosed(positiveResult: Boolean)

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

Inherited functions

Public constructors

<init>

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

<init>

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

<init>

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

<init>

EditTextPreference(context: Context!)

Public methods

getEditText

open fun getEditText(): EditText!

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

Return
EditText!: The EditText widget that will be shown in the dialog.

getText

open fun getText(): String!

Gets the text from the SharedPreferences.

Return
String!: The current preference value.

setText

open fun setText(text: String!): Unit

Saves the text to the SharedPreferences.

Parameters
text String!: The text to save

shouldDisableDependents

open fun shouldDisableDependents(): Boolean

Protected methods

onSaveInstanceState

protected open fun onSaveInstanceState(): Parcelable!

onAddEditTextToDialogView

protected open fun onAddEditTextToDialogView(dialogView: View!, editText: EditText!): Unit

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

Parameters
dialogView View!: The dialog view.

onRestoreInstanceState

protected open fun onRestoreInstanceState(state: Parcelable!): Unit

onGetDefaultValue

protected open fun onGetDefaultValue(a: TypedArray!, index: Int): Any!

onBindDialogView

protected open fun onBindDialogView(view: View!): Unit

onDialogClosed

protected open fun onDialogClosed(positiveResult: Boolean): Unit

onSetInitialValue

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