Code example for CheckBoxPreference

Methods: isChecked

0
    } 
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (preference == mToggleAdvancedSettings) {
            boolean value = mToggleAdvancedSettings.isChecked();
            setAdvancedSettingsEnabled(value);
        } 
 
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    } 
 
    private boolean isAdvancedSettingsEnabled() { 
        return Settings.System.getInt(getContentResolver(), 
                                      Settings.System.ADVANCED_SETTINGS, 
                                      Settings.System.ADVANCED_SETTINGS_DEFAULT) > 0; 
    } 
 
    private void setAdvancedSettingsEnabled(boolean enabled) {
        int value = enabled ? 1 : 0;
        // Change the system setting