added in version 24.1.0
belongs to Maven artifact


public class EditTextPreference
extends DialogPreference


A Preference that allows for string input.

It is a subclass of DialogPreference and shows the EditText in a dialog.

This preference will store a string into the SharedPreferences.


Inherited XML attributes

From class

Inherited constants

From class

Public constructors

EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr)
EditTextPreference(Context context, AttributeSet attrs)
EditTextPreference(Context context)

Public methods

String getText()

Gets the text from the SharedPreferences.

void setText(String text)

Saves the text to the SharedPreferences.

boolean shouldDisableDependents()

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

Protected methods

Object onGetDefaultValue(TypedArray a, int index)

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

void onRestoreInstanceState(Parcelable state)

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