How can I modify the summary of a ListPreference to the new \"Entry\" string selected by the user (not the entry value)
I suppouse its with setOnPreferenceChangeList
Referring to the accepted answer ( @Michael ), if you modify the MyListPreference to add an onPreferenceChangeListener:
public MyListPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
setOnPreferenceChangeListener(this);
}
and have the listener implementation return true:
public boolean onPreferenceChange(Preference preference, Object newValue) {
// Do other stuff as needed, e.g. setTitle()
return true;
}
the summary '%s' always resolves to the latest setting. Otherwise, it always has the default setting.
Don't forget to add implements:
public class MyListPreference extends ListPreference implements Preference.OnPreferenceChangeListener