ListPreference setSummary - 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 setSummary method.

This code example shows how to use the following methods:setSummary
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:findIndexOfValue, getEntries, setSummary
        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 
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        if (preference == mHomeLongPressAction) {
            handleActionListChange(mHomeLongPressAction, newValue,
                    Settings.System.KEY_HOME_LONG_PRESS_ACTION); 
            return true; 
        } else if (preference == mHomeDoubleTapAction) {
            handleActionListChange(mHomeDoubleTapAction, newValue,
                    Settings.System.KEY_HOME_DOUBLE_TAP_ACTION); 
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
		if (p != null && p instanceof ListPreference) updateSummary((ListPreference)p);
	} 
 
	void updateSummary(ListPreference lp)
	{ 
		lp.setSummary(lp.getEntry());
		getListView().postInvalidate();
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getEntry, setSummary, setOnPreferenceChangeListener
This code example shows how to use the following methods:getEntry, setSummary, setOnPreferenceChangeListener
This code example shows how to use the following methods:findIndexOfValue, getEntries, setSummary
This code example shows how to use the following methods:getEntry, setSummary

Related ListPreference setSummary Questions & Answers:

setSummary Method Overview
Sets the summary for this Preference with a CharSequence.
See Code Examples for other Android ListPreference Methods: