|
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.ListPreference
public class ListPreference
The ListPreference is a preference that displays a list of entries as
a dialog.
This preference will store a string into the SharedPreferences. This string will be the value
from the setEntryValues(CharSequence[]) array.
| 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 | |
|---|---|
ListPreference(Context context)
|
|
ListPreference(Context context,
AttributeSet attrs)
|
|
| Method Summary | |
|---|---|
int |
findIndexOfValue(String value)
Returns the index of the given value (in the entry values array). |
CharSequence[] |
getEntries()
The list of entries to be shown in the list in subsequent dialogs. |
CharSequence |
getEntry()
Returns the entry corresponding to the current value. |
CharSequence[] |
getEntryValues()
Returns the array of values to be saved for the preference. |
String |
getValue()
Returns the value of the key. |
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 |
onPrepareDialogBuilder(AlertDialog.Builder builder)
Prepares the dialog builder to be shown when the preference is clicked. |
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 |
setEntries(CharSequence[] entries)
Sets the human-readable entries to be shown in the list. |
void |
setEntries(int entriesResId)
|
void |
setEntryValues(CharSequence[] entryValues)
The array to find the value to save for a preference when an entry from entries is selected. |
void |
setEntryValues(int entryValuesResId)
|
void |
setValue(String value)
Sets the value of the key. |
void |
setValueIndex(int index)
Sets the value to the given index from the entry values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ListPreference(Context context,
AttributeSet attrs)
public ListPreference(Context context)
| Method Detail |
|---|
public void setEntries(CharSequence[] entries)
Each entry must have a corresponding index in
setEntryValues(CharSequence[]).
entries - The entries.setEntryValues(CharSequence[])public void setEntries(int entriesResId)
entriesResId - The entries array as a resource.setEntries(CharSequence[])public CharSequence[] getEntries()
public void setEntryValues(CharSequence[] entryValues)
entryValues - The array to be used as values to save for the preference.public void setEntryValues(int entryValuesResId)
entryValuesResId - The entry values array as a resource.setEntryValues(CharSequence[])public CharSequence[] getEntryValues()
public void setValue(String value)
getEntryValues().
value - The value to set for the key.public void setValueIndex(int index)
index - The index of the value to set.public String getValue()
getEntryValues().
public CharSequence getEntry()
public int findIndexOfValue(String value)
value - The value whose index should be returned.
protected void onPrepareDialogBuilder(AlertDialog.Builder builder)
DialogPreference
Do not AlertDialog.Builder#create() or
AlertDialog.Builder#show().
onPrepareDialogBuilder in class DialogPreferenceprotected 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.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 | |||||||||