Stay organized with collections Save and categorize content based on your preferences.
added in version 24.1.0
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1

EditTextPreference

public class EditTextPreference
extends DialogPreference

java.lang.Object
   ↳ android.support.v7.preference.Preference
     ↳ android.support.v7.preference.DialogPreference
       ↳ android.support.v7.preference.EditTextPreference


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.

Summary

Inherited XML attributes

From class android.support.v7.preference.Preference

Inherited constants

From class android.support.v7.preference.Preference

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().

Parcelable onSaveInstanceState()

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.

void onSetInitialValue(boolean restoreValue, Object defaultValue)

Implement this to set the initial value of the Preference.

Inherited methods

From class android.support.v7.preference.DialogPreference
From class android.support.v7.preference.Preference
From class java.lang.Object