|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.preference.Preference
android.preference.DialogPreference
android.preference.EditTextPreference
public class EditTextPreference
The EditTextPreference class is 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class android.preference.Preference |
|---|
Preference.BaseSavedState, Preference.OnPreferenceChangeInternalListener, Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener |
| Field Summary |
|---|
| Fields inherited from class android.preference.Preference |
|---|
DEFAULT_ORDER |
| Constructor Summary | |
|---|---|
EditTextPreference(Context context)
|
|
EditTextPreference(Context context,
AttributeSet attrs)
|
|
EditTextPreference(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
EditText |
getEditText()
Returns the EditText widget that will be shown in the dialog. |
String |
getText()
Gets the text from the SharedPreferences. |
protected void |
onAddEditTextToDialogView(View dialogView,
EditText editText)
Adds the EditText widget of this preference to the dialog's view. |
protected void |
onBindDialogView(View view)
Binds views in the content View of the dialog to data. |
protected void |
onDialogClosed(boolean positiveResult)
Called when the dialog is dismissed and should be used to save data to the SharedPreferences. |
protected Object |
onGetDefaultValue(TypedArray a,
int index)
Called when Preference is being inflated and the default value
attribute needs to be read. |
protected void |
onRestoreInstanceState(Parcelable state)
Hook allowing a preference to re-apply a representation of its internal state that had previously been generated by Preference.onSaveInstanceState(). |
protected 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. |
protected void |
onSetInitialValue(boolean restoreValue,
Object defaultValue)
Implement this to set the initial value of the Preference. |
void |
setText(String text)
Saves the text to the SharedPreferences. |
boolean |
shouldDisableDependents()
Should return whether this preference's dependents should currently be disabled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EditTextPreference(Context context,
AttributeSet attrs,
int defStyle)
public EditTextPreference(Context context,
AttributeSet attrs)
public EditTextPreference(Context context)
| Method Detail |
|---|
public void setText(String text)
SharedPreferences.
text - The text to savepublic String getText()
SharedPreferences.
protected void onBindDialogView(View view)
DialogPreferenceMake sure to call through to the superclass implementation.
onBindDialogView in class DialogPreferenceview - The content View of the dialog, if it is custom.
protected void onAddEditTextToDialogView(View dialogView,
EditText editText)
dialogView - The dialog view.protected void onDialogClosed(boolean positiveResult)
DialogPreferenceSharedPreferences.
onDialogClosed in class DialogPreferencepositiveResult - Whether the positive button was clicked (true), or
the negative button was clicked or the dialog was canceled (false).
protected Object onGetDefaultValue(TypedArray a,
int index)
PreferencePreference is being inflated and the default value
attribute needs to be read. Since different preference types have
different value types, the subclass should get and return the default
value which will be its value type.
For example, if the value type is String, the body of the method would
proxy to TypedArray.getString(int).
onGetDefaultValue in class Preferencea - The set of attributes.index - The index of the default value attribute.
protected void onSetInitialValue(boolean restoreValue,
Object defaultValue)
PreferencePreference.shouldPersist()) to defaultValue.
This may not always be called. One example is if it should not persist but there is no default value given.
onSetInitialValue in class PreferencerestoreValue - Whether to restore the persisted value
(true), or use the given default value (false).defaultValue - The default value. Only use if restoreValue is false.public boolean shouldDisableDependents()
Preference
shouldDisableDependents in class Preferencepublic EditText getEditText()
EditText widget that will be shown in the dialog.
EditText widget that will be shown in the dialog.protected Parcelable onSaveInstanceState()
Preference
onSaveInstanceState in class DialogPreferencePreference.onRestoreInstanceState(android.os.Parcelable),
Preference.saveHierarchyState(android.os.Bundle),
Preference.dispatchSaveInstanceState(android.os.Bundle)protected void onRestoreInstanceState(Parcelable state)
PreferencePreference.onSaveInstanceState().
This function will never be called with a null icicle.
onRestoreInstanceState in class DialogPreferencestate - The frozen state that had previously been returned by
Preference.onSaveInstanceState().Preference.onSaveInstanceState(),
Preference.restoreHierarchyState(android.os.Bundle),
Preference.dispatchRestoreInstanceState(android.os.Bundle)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||