Example usage for android.preference ListPreference getSummary

List of usage examples for android.preference ListPreference getSummary

Introduction

In this page you can find the example usage for android.preference ListPreference getSummary.

Prototype

@Override
public CharSequence getSummary() 

Source Link

Document

Returns the summary of this ListPreference.

Usage

From source file:com.hichinaschool.flashcards.anki.Preferences.java

private void updateListPreference(String key) {
    ListPreference listpref = (ListPreference) getPreferenceScreen().findPreference(key);
    String entry;/*  w w w .  ja v  a 2s  . co  m*/
    try {
        entry = listpref.getEntry().toString();
    } catch (NullPointerException e) {
        Log.e(AnkiDroidApp.TAG, "Error getting set preference value of " + key + ": " + e);
        entry = "?";
    }
    if (mListsToUpdate.containsKey(key)) {
        listpref.setSummary(replaceString(mListsToUpdate.get(key), entry));
    } else {
        String oldsum = (String) listpref.getSummary();
        if (oldsum.contains("XXX")) {
            mListsToUpdate.put(key, oldsum);
            listpref.setSummary(replaceString(oldsum, entry));
        } else {
            listpref.setSummary(entry);
        }
    }
}