Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

EditTextPreference

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

A DialogPreference that shows a EditText in the dialog.

This preference saves a string value.

Summary

Nested classes
abstract

Interface definition for a callback to be invoked when the corresponding dialog view for this preference is bound.

A simple androidx.preference.Preference.SummaryProvider implementation for an EditTextPreference.

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 EditTextPreference.OnBindEditTextListener?

Returns the OnBindEditTextListener used to configure the EditText displayed in the corresponding dialog view for this preference.

open String!

Gets the text from the current data storage.

open Unit
setText(text: String!)

Saves the text to the current data storage.

open Unit

Set an OnBindEditTextListener that will be invoked when the corresponding dialog view for this preference is bound.

open Boolean

Protected methods
open Parcelable!

open Unit

open Any!

open Unit
onSetInitialValue(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

getOnBindEditTextListener

@Nullable open fun getOnBindEditTextListener(): EditTextPreference.OnBindEditTextListener?

Returns the OnBindEditTextListener used to configure the EditText displayed in the corresponding dialog view for this preference.

Return
EditTextPreference.OnBindEditTextListener?: The OnBindEditTextListener set for this preference, or null if there is no OnBindEditTextListener set

getText

open fun getText(): String!

Gets the text from the current data storage.

Return
String!: The current preference value

setText

open fun setText(text: String!): Unit

Saves the text to the current data storage.

Parameters
text String!: The text to save

setOnBindEditTextListener

open fun setOnBindEditTextListener(@Nullable onBindEditTextListener: EditTextPreference.OnBindEditTextListener?): Unit

Set an OnBindEditTextListener that will be invoked when the corresponding dialog view for this preference is bound. Set null to remove the existing OnBindEditTextListener.

Parameters
onBindEditTextListener EditTextPreference.OnBindEditTextListener?: The OnBindEditTextListener that will be invoked when the corresponding dialog view for this preference is bound

shouldDisableDependents

open fun shouldDisableDependents(): Boolean

Protected methods

onSaveInstanceState

protected open fun onSaveInstanceState(): Parcelable!

onRestoreInstanceState

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

onGetDefaultValue

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

onSetInitialValue

protected open fun onSetInitialValue(defaultValue: Any?): Unit