Code example for PreferenceGroup

Methods: setEnabled, setOrderingAsAdded

0
        mApplicationPrefList.setOrderingAsAdded(false);
    } 
 
    private void refreshCustomApplicationPrefs() { 
        Context context = getActivity();
 
        if (!parsePackageList()) { 
            return; 
        } 
 
        // Add the Application Preferences 
        if (mApplicationPrefList != null) {
            mApplicationPrefList.removeAll();
 
            for (Package pkg : mPackages.values()) {
                try { 
                    PackageInfo info = mPackageManager.getPackageInfo(pkg.name,
                            PackageManager.GET_META_DATA);
                    ApplicationLightPreference pref =
                            new ApplicationLightPreference(context, pkg.color, pkg.timeon, pkg.timeoff);
 
                    pref.setKey(pkg.name);
                    pref.setTitle(info.applicationInfo.loadLabel(mPackageManager));
                    pref.setIcon(info.applicationInfo.loadIcon(mPackageManager));
                    pref.setPersistent(false);
                    pref.setOnPreferenceChangeListener(this);
 
                    mApplicationPrefList.addPreference(pref);
                } catch (NameNotFoundException e) {
                    // Do nothing 
                } 
            } 
        } 
    } 
 
    private void addCustomApplicationPref(String packageName) {
        Package pkg = mPackages.get(packageName);
        if (pkg == null) {
            pkg = new Package(packageName, mDefaultColor, mDefaultLedOn, mDefaultLedOff);
            mPackages.put(packageName, pkg);
            savePackageList(false); 
            refreshCustomApplicationPrefs(); 
        } 
    } 
 
    private void removeCustomApplicationPref(String packageName) {
        if (mPackages.remove(packageName) != null) {
            savePackageList(false); 
            refreshCustomApplicationPrefs(); 
        } 
    } 
 
    private boolean parsePackageList() { 
        final String baseString = Settings.System.getString(getContentResolver(),
                Settings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES); 
 
        if (TextUtils.equals(mPackageList, baseString)) {