Code example for CheckBoxPreference

Methods: setEnabledsetOnPreferenceChangeListener, isChecked

0
    } 
 
    public void setListeners(boolean enable) {
        if (enable) {
            volUpShutter.setOnPreferenceChangeListener(this);
            volDownShutter.setOnPreferenceChangeListener(this);
            searchShutter.setOnPreferenceChangeListener(this);
            volZoom.setOnPreferenceChangeListener(this);
            longFocus.setOnPreferenceChangeListener(this);
            preFocus.setOnPreferenceChangeListener(this);
        } else { 
            volUpShutter.setOnPreferenceChangeListener(null);
            volDownShutter.setOnPreferenceChangeListener(null);
            searchShutter.setOnPreferenceChangeListener(null);
            volZoom.setOnPreferenceChangeListener(null);
            longFocus.setOnPreferenceChangeListener(null);
            preFocus.setOnPreferenceChangeListener(null);
        } 
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        checkBoxes(); 
        setListeners(true); 
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        setListeners(false); 
    } 
 
    @Override 
    protected void onDestroy() { 
        super.onDestroy(); 
        setListeners(false); 
    } 
 
    public void checkBoxes() { 
        if (volUpShutter.isChecked() || volDownShutter.isChecked()) {
            volZoom.setEnabled(false);
        } else if (!volUpShutter.isChecked() && !volDownShutter.isChecked()) {
            volZoom.setEnabled(true);
        } 
        if (volZoom.isChecked()) {
            volUpShutter.setEnabled(false);
            volDownShutter.setEnabled(false);
            longFocus.setEnabled(false);
        } else { 
            volUpShutter.setEnabled(true);
            volDownShutter.setEnabled(true);
            longFocus.setEnabled(true);
        } 
        if (longFocus.isChecked()) {
            preFocus.setEnabled(false);
        } else {