Code example for ListPreference

Methods: findIndexOfValue

0
    @Override 
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        String key = preference.getKey();
 
        if (PREFERENCE_KEY_AUTO_ADVANCE.equals(key)) {
            mPreferences.setAutoAdvanceDirection(mAutoAdvance.findIndexOfValue((String) newValue));
            return true; 
        } else if (PREFERENCE_KEY_TEXT_ZOOM.equals(key)) {
            mPreferences.setTextZoom(mTextZoom.findIndexOfValue((String) newValue));
            reloadDynamicSummaries(); 
            return true; 
        } 
        return false; 
    } 
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (getActivity() == null) {
            // Guard against monkeys. 
            return false;