Code example for ListPreference

Methods: setOnPreferenceChangeListener, getEntry, setSummary, setValue

0
     * @return The {@link ListPreference} instance identified by {@code key}. 
     */ 
    protected ListPreference setupListPreference(final String key, final String value)
    { 
        final ListPreference prefView = (ListPreference) findPreference(key);
        prefView.setValue(value);
        prefView.setSummary(prefView.getEntry());
        prefView.setOnPreferenceChangeListener(new PreferenceChangeListener(prefView));
        return prefView;
    } 
 
    /** 
     * Initialize a given {@link ListPreference} instance. 
     * 
     * @param prefView 
     *         The {@link ListPreference} instance to initialize. 
     * @param value 
     *         Initial value for the {@link ListPreference} object. 
     * @param entries 
     *         Sets the human-readable entries to be shown in the list. 
     * @param entryValues