ListPreference setValue - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ListPreference setValue method.

This code example shows how to use the following methods:setSummary, setValue, getKey
            updateEntry(pref);
        } 
    } 
 
    private void updateEntry(ListPreference pref) {
        String value = Settings.System.getString(getContentResolver(), pref.getKey());
        if (value == null) {
            value = "";
        } 
 
        CharSequence entry = findEntryForValue(pref, value);
        if (entry != null) {
            pref.setValue(value);
            pref.setSummary(entry);
            return; 
        } 
    } 
 
    private CharSequence findEntryForValue(ListPreference pref, CharSequence value) {
        CharSequence[] entries = pref.getEntryValues();
8
CodeRank
This code example shows how to use the following methods:getEntry, setSummary, setValue
    } 
 
    private void updateState() { 
 
        mVibrateMode.setValue(mProfileGroup.getVibrateMode().name());
        mSoundMode.setValue(mProfileGroup.getSoundMode().name());
        mRingerMode.setValue(mProfileGroup.getRingerMode().name());
        mLightsMode.setValue(mProfileGroup.getLightsMode().name());
 
        mVibrateMode.setSummary(mVibrateMode.getEntry());
        mSoundMode.setSummary(mSoundMode.getEntry());
        mRingerMode.setSummary(mRingerMode.getEntry());
        mLightsMode.setSummary(mLightsMode.getEntry());
 
        if (mProfileGroup.getSoundOverride() != null) {
            mSoundTone.setRingtone(mProfileGroup.getSoundOverride());
        } 
 
        if (mProfileGroup.getRingerOverride() != null) {
            mRingTone.setRingtone(mProfileGroup.getRingerOverride());
8
CodeRank
This code example shows how to use the following methods:setSummary, setValue
This code example shows how to use the following methods:getEntry, setSummary, setValue
        } 
    } 
 
    private ListPreference initActionList(String key, int value) {
        ListPreference list = (ListPreference) getPreferenceScreen().findPreference(key);
        list.setValue(Integer.toString(value));
        list.setSummary(list.getEntry());
        list.setOnPreferenceChangeListener(this);
        return list;
    } 
 
    private void handleActionListChange(ListPreference pref, Object newValue, String setting) {
        String value = (String) newValue;
        int index = pref.findIndexOfValue(value);
 
        pref.setSummary(pref.getEntries()[index]);
        Settings.System.putInt(getContentResolver(), setting, Integer.valueOf(value));
    } 
 
    @Override 
7
CodeRank
This code example shows how to use the following methods:setEntries, setEntryValues, setSummary, setValue, setEnabled
	public static void PopulateList(Preference preference, String[] List) {
		ListPreference PrefList = (ListPreference)preference;
		if (List == null) {
			PrefList.setEnabled(false);
		} else { 
			PrefList.setEntryValues(List); 
			PrefList.setEntries(List);
			PrefList.setEnabled(true);
		} 
	} 
 
	// 
	// fill filesystem lists with files from array of strings[] 
	// 
	public static void PopulateFSList(Preference preference, String[] List, String filesystem) {
		PopulateList(preference, List);
		ListPreference PrefList = (ListPreference)preference;
		if (filesystem != null) {
			String currentfs = GetCurrentFileSystem(filesystem);
			PrefList.setSummary("current filesystem: " +  currentfs);

6
CodeRank
This code example shows how to use the following methods:setValue, setKey
	 */ 
	@SuppressWarnings("deprecation") 
	protected final ListPreference initListPreference(String baseName, String defValue) {
		// Update the loaded Preference with the actual preference key to load/store with 
		ListPreference pref = (ListPreference) findPreference(baseName);
		pref.setKey(baseName + "_" + key);
		// Update the Preference by selecting the current stored value in the list, if it exists 
		pref.setValue(sharedPrefs.getString(baseName + "_" + key, defValue));
		return pref;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:setSummary, setValue, getKey
            updateEntry(pref);
        } 
    } 
 
    private void updateEntry(ListPreference pref) {
        String value = Settings.System.getString(getContentResolver(), pref.getKey());
        if (value == null) {
            value = "";
        } 
 
        CharSequence entry = findEntryForValue(pref, value);
        if (entry != null) {
            pref.setValue(value);
            pref.setSummary(entry);
            return; 
        } 
    } 
 
    private CharSequence findEntryForValue(ListPreference pref, CharSequence value) {
        CharSequence[] entries = pref.getEntryValues();
6
CodeRank
This code example shows how to use the following methods:getEntry, setSummary, setValue
    } 
 
	@Override 
	public boolean onPreferenceChange(Preference preference, Object newValue) {
		ListPreference lp = (ListPreference)preference;
		lp.setValue((String)newValue);
		updateListPreferenceSummary(preference);
		return false; 
	} 
	 
	// ListPreference�̐ݒ����e��summary�ɐݒ肷�� 
	private void updateListPreferenceSummary(Preference preference) {
		ListPreference p = (ListPreference)preference;
		p.setSummary(p.getEntry());
	} 
     
} 
6
CodeRank
This code example shows how to use the following methods:findIndexOfValue, getEntries, setSummary, setValue
         */ 
        @Override 
        public boolean onPreferenceChange(final Preference preference, final Object newValue)
        { 
            final String summary = newValue.toString();
            final int index = mPrefView.findIndexOfValue(summary);
            mPrefView.setSummary(mPrefView.getEntries()[index]);
            mPrefView.setValue(summary);
            return false; 
        } 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:getEntry, setSummary, setValue
    private void updateState() { 
 
        mVibrateMode.setValue(mProfileGroup.getVibrateMode().name());
        mSoundMode.setValue(mProfileGroup.getSoundMode().name());
        mRingerMode.setValue(mProfileGroup.getRingerMode().name());
        mLightsMode.setValue(mProfileGroup.getLightsMode().name());
 
        mVibrateMode.setSummary(mVibrateMode.getEntry());
        mSoundMode.setSummary(mSoundMode.getEntry());
        mRingerMode.setSummary(mRingerMode.getEntry());
        mLightsMode.setSummary(mLightsMode.getEntry());
 
        if (mProfileGroup.getSoundOverride() != null) {
            mSoundTone.setRingtone(mProfileGroup.getSoundOverride());
        } 
 
        if (mProfileGroup.getRingerOverride() != null) {
            mRingTone.setRingtone(mProfileGroup.getRingerOverride());
        } 
 
6
CodeRank

Related ListPreference setValue Questions & Answers:

setValue Method Overview
Sets the value of the key.
See Code Examples for other Android ListPreference Methods: