public class SettingSpinnerPreference extends SettingPreference
SettingPreference implementation that provides Spinner widget with its related
functionality. Entries that should be available for selection as drop down items of the Spinner
widget may be specified via setEntries(CharSequence[]) along with theirs corresponding
entry values that should be specified via setEntryValues(CharSequence[])
This preference implementation by default displays a single Spinner widget with a primary
view containing title text of the preference and summary text which corresponds to the current
selected entry value. The preferred entry value may be specified via setValue(String) and
obtained via getValue().
String which should contain a single entry
value that should be by default selected. See TypedArray.getString(int).
SettingPreference,
SettingSpinnerPreference Attributes
uiSettingSpinnerPreferenceStyle| Constructor and Description |
|---|
SettingSpinnerPreference(android.content.Context context)
Same as
SettingSpinnerPreference(Context, AttributeSet) without attributes. |
SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs)
Same as
SettingSpinnerPreference(Context, AttributeSet, int) with
R.attr#uiSettingSpinnerPreferenceStyle as attribute for default style. |
SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
SettingSpinnerPreference(Context, AttributeSet, int, int) with 0
as default style. |
SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of SettingSpinnerPreference for the given context.
|
| Modifier and Type | Method and Description |
|---|---|
CharSequence[] |
getEntries()
Returns the array of entries specified for this preference.
|
CharSequence[] |
getEntryValues()
Returns the array of entry values associated with the entries specified for this preference.
|
String |
getValue()
Returns the preferred entry value of this preference.
|
void |
onBindView(android.view.View view) |
protected void |
onClick() |
protected Object |
onGetDefaultValue(android.content.res.TypedArray attributes,
int index) |
protected void |
onPrepareForRemoval() |
protected void |
onSetInitialValue(boolean restorePersistedValue,
Object defaultValue) |
void |
setEntries(CharSequence[] entries)
Specifies an array of entries that should be displayed in the
Spinner widget of
this preference. |
void |
setEntries(int resId)
Same as
setEntries(CharSequence[]) for resource id. |
void |
setEntryValues(CharSequence[] entryValues)
Specifies an array of entry values where each value should be associated with corresponding
entry from the entries array specified via
setEntries(CharSequence[]). |
void |
setEntryValues(int resId)
Same as
setEntryValues(CharSequence[]) for resource id. |
void |
setTitle(CharSequence title) |
void |
setValue(String value)
Sets a preferred entry value for this preference.
|
setKeycallChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPersistedStringSet, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onCreateView, onDependencyChanged, onParentChanged, onRestoreInstanceState, onSaveInstanceState, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, persistStringSet, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toStringpublic SettingSpinnerPreference(android.content.Context context)
SettingSpinnerPreference(Context, AttributeSet) without attributes.public SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs)
SettingSpinnerPreference(Context, AttributeSet, int) with
R.attr#uiSettingSpinnerPreferenceStyle as attribute for default style.public SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
SettingSpinnerPreference(Context, AttributeSet, int, int) with 0
as default style.public SettingSpinnerPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
context - Context in which will be the new setting preference presented.attrs - Set of Xml attributes used to configure the new instance of this preference.defStyleAttr - An attribute which contains a reference to a default style resource for
this preference within a theme of the given context.defStyleRes - Resource id of the default style for the new preference.public void setTitle(CharSequence title)
setTitle in class android.preference.Preferencepublic void setEntries(int resId)
setEntries(CharSequence[]) for resource id.resId - Resource id of the desired text array with entries.public void setEntries(CharSequence[] entries)
Spinner widget of
this preference.entries - The desired array of entries. May be null to clear the current ones.R.attr.entries,
setEntryValues(CharSequence[])public CharSequence[] getEntries()
null if no entries have been specified.setEntries(CharSequence[]),
getEntryValues()public void setEntryValues(int resId)
setEntryValues(CharSequence[]) for resource id.resId - Resource id of the desired text array with values for entries.public void setEntryValues(CharSequence[] entryValues)
setEntries(CharSequence[]).
Note, that this method does not check if the entries and entry values arrays are consistent, that is that they are equal in length.
entryValues - The desired array of values associated with entries. May be null
to clear the current ones.R.attr.entryValuespublic CharSequence[] getEntryValues()
null if no entry values have been specified.setEntryValues(CharSequence[]),
getEntries()protected Object onGetDefaultValue(android.content.res.TypedArray attributes, int index)
onGetDefaultValue in class android.preference.Preferenceprotected void onSetInitialValue(boolean restorePersistedValue,
Object defaultValue)
onSetInitialValue in class android.preference.Preferencepublic void setValue(String value)
If value of this preference changes, it is persisted and the change listener is notified about the change.
value - The preferred entry value to be persisted.getValue()public String getValue()
setValue(String)public void onBindView(android.view.View view)
onBindView in class SettingPreferenceprotected void onClick()
onClick in class android.preference.Preferenceprotected void onPrepareForRemoval()
onPrepareForRemoval in class android.preference.Preference