|
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.CheckBoxPreference
public class CheckBoxPreference
The CheckBoxPreference is a preference that provides checkbox widget
functionality.
This preference will store a boolean into the SharedPreferences.
| 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 | |
|---|---|
CheckBoxPreference(Context context)
|
|
CheckBoxPreference(Context context,
AttributeSet attrs)
|
|
CheckBoxPreference(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
boolean |
getDisableDependentsState()
Returns whether dependents are disabled when this preference is on ( true)
or when this preference is off (false). |
CharSequence |
getSummaryOff()
Returns the summary to be shown when unchecked. |
CharSequence |
getSummaryOn()
Returns the summary to be shown when checked. |
boolean |
isChecked()
Returns the checked state. |
protected void |
onBindView(View view)
Binds the created View to the data for the preference. |
protected void |
onClick()
Processes a click on the preference. |
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 |
setChecked(boolean checked)
Sets the checked state and saves it to the SharedPreferences. |
void |
setDisableDependentsState(boolean disableDependentsState)
Sets whether dependents are disabled when this preference is on ( true)
or when this preference is off (false). |
void |
setSummaryOff(CharSequence summary)
Sets the summary to be shown when unchecked. |
void |
setSummaryOff(int summaryResId)
|
void |
setSummaryOn(CharSequence summary)
Sets the summary to be shown when checked. |
void |
setSummaryOn(int summaryResId)
|
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 CheckBoxPreference(Context context,
AttributeSet attrs,
int defStyle)
public CheckBoxPreference(Context context,
AttributeSet attrs)
public CheckBoxPreference(Context context)
| Method Detail |
|---|
protected void onBindView(View view)
PreferenceThis is a good place to grab references to custom Views in the layout and set properties on them.
Make sure to call through to the superclass's implementation.
onBindView in class Preferenceview - The View that shows this preference.Preference.onCreateView(ViewGroup)protected void onClick()
PreferenceSharedPreferences. However, the overridden method should
call Preference.callChangeListener(Object) to make sure the client wants to
update the preference's state with the new value.
onClick in class Preferencepublic void setChecked(boolean checked)
SharedPreferences.
checked - The checked state.public boolean isChecked()
public boolean shouldDisableDependents()
Preference
shouldDisableDependents in class Preferencepublic void setSummaryOn(CharSequence summary)
summary - The summary to be shown when checked.public void setSummaryOn(int summaryResId)
summaryResId - The summary as a resource.setSummaryOn(CharSequence)public CharSequence getSummaryOn()
public void setSummaryOff(CharSequence summary)
summary - The summary to be shown when unchecked.public void setSummaryOff(int summaryResId)
summaryResId - The summary as a resource.setSummaryOff(CharSequence)public CharSequence getSummaryOff()
public boolean getDisableDependentsState()
true)
or when this preference is off (false).
true)
or when this preference is off (false).public void setDisableDependentsState(boolean disableDependentsState)
true)
or when this preference is off (false).
disableDependentsState - The preference state that should disable dependents.
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 PreferencePreference.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 Preferencestate - 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 | |||||||||