PreferenceGroup removePreference - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PreferenceGroup removePreference method.

This code example shows how to use the following methods:removePreference
        boolean hasTtsPrefs = populateOrRemoveTtsPrefs();
        if (!hasRecognizerPrefs && !hasTtsPrefs) {
            // There were no TTS settings and no recognizer settings, 
            // so it should be safe to hide the preference category 
            // entirely. 
            mFragment.getPreferenceScreen().removePreference(mVoiceCategory);
        } 
    } 
 
    private boolean populateOrRemoveRecognizerPrefs() { 
        List<ResolveInfo> availableRecognitionServices =
                mFragment.getPackageManager().queryIntentServices(
                        new Intent(RecognitionService.SERVICE_INTERFACE),
                        PackageManager.GET_META_DATA);
        int numAvailable = availableRecognitionServices.size();
 
        if (numAvailable == 0) {
            mVoiceCategory.removePreference(mRecognizerPref);
            mVoiceCategory.removePreference(mRecognizerSettingsPref);
            return false; 

7
CodeRank
This code example shows how to use the following methods:findPreference, removePreference
This code example shows how to use the following methods:addPreference, findPreference, removePreference
This code example shows how to use the following methods:removePreference
        boolean hasTtsPrefs = populateOrRemoveTtsPrefs();
        if (!hasRecognizerPrefs && !hasTtsPrefs) {
            // There were no TTS settings and no recognizer settings, 
            // so it should be safe to hide the preference category 
            // entirely. 
            mFragment.getPreferenceScreen().removePreference(mVoiceCategory);
        } 
    } 
 
    private boolean populateOrRemoveRecognizerPrefs() { 
        List<ResolveInfo> availableRecognitionServices =
                mFragment.getPackageManager().queryIntentServices(
                        new Intent(RecognitionService.SERVICE_INTERFACE),
                        PackageManager.GET_META_DATA);
        int numAvailable = availableRecognitionServices.size();
 
        if (numAvailable == 0) {
            mVoiceCategory.removePreference(mRecognizerPref);
            mVoiceCategory.removePreference(mRecognizerSettingsPref);
            return false; 

6
CodeRank
This code example shows how to use the following methods:findPreference, removePreference
This code example shows how to use the following methods:findPreference, removePreference
This code example shows how to use the following methods:findPreference, removePreference
        int vmailColor = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_COLOR, mDefaultColor);
        int vmailTimeOn = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_LED_ON, mDefaultLedOn);
        int vmailTimeOff = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_LED_OFF, mDefaultLedOff);
 
        PreferenceScreen prefSet = getPreferenceScreen();
        PreferenceGroup generalPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
        if (generalPrefs != null) {
 
            // Pulse preference 
            CheckBoxPreference cPref = (CheckBoxPreference) prefSet.findPreference(PULSE_PREF);
            cPref.setChecked(mLightEnabled);
            cPref.setOnPreferenceChangeListener(this);
 
            // Default preference 
            mDefaultPref = (ApplicationLightPreference) prefSet.findPreference(DEFAULT_PREF);
            mDefaultPref.setAllValues(color, timeOn, timeOff);
            mDefaultPref.setEnabled(mLightEnabled);
            mDefaultPref.setOnPreferenceChangeListener(this);
 
            // Custom enabled preference 

5
CodeRank
This code example shows how to use the following methods:findPreference, removePreference
        int vmailColor = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_COLOR, mDefaultColor);
        int vmailTimeOn = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_LED_ON, mDefaultLedOn);
        int vmailTimeOff = Settings.System.getInt(resolver, NOTIFICATION_LIGHT_PULSE_VMAIL_LED_OFF, mDefaultLedOff);
 
        PreferenceScreen prefSet = getPreferenceScreen();
        PreferenceGroup generalPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
        if (generalPrefs != null) {
 
            // Pulse preference 
            CheckBoxPreference cPref = (CheckBoxPreference) prefSet.findPreference(PULSE_PREF);
            cPref.setChecked(mLightEnabled);
            cPref.setOnPreferenceChangeListener(this);
 
            // Default preference 
            mDefaultPref = (ApplicationLightPreference) prefSet.findPreference(DEFAULT_PREF);
            mDefaultPref.setAllValues(color, timeOn, timeOff);
            mDefaultPref.setEnabled(mLightEnabled);
            mDefaultPref.setOnPreferenceChangeListener(this);
 
            // Custom enabled preference 

5
CodeRank
This code example shows how to use the following methods:findPreference, removePreference
This code example shows how to use the following methods:findPreference, removePreference

Related PreferenceGroup removePreference Questions & Answers:

removePreference Method Overview
Removes a Preference from this group.
See Code Examples for other Android PreferenceGroup Methods: