Code example for Preference

Methods: setSummary

0
        setAppSummary(mCustomLongSearchAppActivityPref, Settings.System.USE_CUSTOM_LONG_SEARCH_APP_ACTIVITY);
    } 
 
    private void setAppSummary(Preference pref, String key) {
        String value = Settings.System.getString(getContentResolver(), key);
        pref.setSummary(mPicker.getFriendlyNameForUri(value));
    } 
 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        boolean value;
        if (preference == mCustomSearchAppTogglePref) {
            value = mCustomSearchAppTogglePref.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.USE_CUSTOM_SEARCH_APP_TOGGLE, value ? 1 : 0);
            return true; 
        } else if (preference == mCustomLongSearchAppTogglePref) {
            value = mCustomLongSearchAppTogglePref.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.USE_CUSTOM_LONG_SEARCH_APP_TOGGLE, value ? 1 : 0);
            return true; 
        } else if (preference == mCustomSearchAppActivityPref) {