FileDocCategorySizeDatePackage
CheckBoxPreference.javaAPI DocAndroid 5.1 API2693Thu Mar 12 22:22:10 GMT 2015android.preference

CheckBoxPreference

public class CheckBoxPreference extends TwoStatePreference
A {@link Preference} that provides checkbox widget functionality.

This preference will store a boolean into the SharedPreferences.

attr
ref android.R.styleable#CheckBoxPreference_summaryOff
attr
ref android.R.styleable#CheckBoxPreference_summaryOn
attr
ref android.R.styleable#CheckBoxPreference_disableDependentsState

Fields Summary
Constructors Summary
public CheckBoxPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)

        this(context, attrs, defStyleAttr, 0);
    
public CheckBoxPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)

        super(context, attrs, defStyleAttr, defStyleRes);

        final TypedArray a = context.obtainStyledAttributes(attrs,
                com.android.internal.R.styleable.CheckBoxPreference, defStyleAttr, defStyleRes);
        setSummaryOn(a.getString(com.android.internal.R.styleable.CheckBoxPreference_summaryOn));
        setSummaryOff(a.getString(com.android.internal.R.styleable.CheckBoxPreference_summaryOff));
        setDisableDependentsState(a.getBoolean(
                com.android.internal.R.styleable.CheckBoxPreference_disableDependentsState, false));
        a.recycle();
    
public CheckBoxPreference(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, com.android.internal.R.attr.checkBoxPreferenceStyle);
    
public CheckBoxPreference(android.content.Context context)

        this(context, null);
    
Methods Summary
protected voidonBindView(android.view.View view)

        super.onBindView(view);

        View checkboxView = view.findViewById(com.android.internal.R.id.checkbox);
        if (checkboxView != null && checkboxView instanceof Checkable) {
            ((Checkable) checkboxView).setChecked(mChecked);
        }

        syncSummaryView(view);