Code example for ListPreference

Methods: getKey

0
    public boolean onPreferenceChange(Preference pref, Object newValue) {
        /* we only have ListPreferences, so know newValue is a string */ 
        ListPreference list = (ListPreference) pref;
        String value = (String) newValue;
 
        if (Settings.System.putString(getContentResolver(), list.getKey(), value)) {
            pref.setSummary(findEntryForValue(list, value));
        } 
 
        return true; 
    } 
 
}