Change the summary of a ListPreference with the new value (Android)

前端 未结 14 1117
感动是毒
感动是毒 2020-12-30 03:01

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

14条回答
  •  春和景丽
    2020-12-30 03:43

    I recommend to implement the OnSharedPreferenceChangeListener in your PreferenceFragment or PreferenceActivity instead of Preference.setOnPreferenceChangeListner. Use setSummay to set the new changes. (Do not forget to register and unregister the listener.) This listener is called after the change to the preference has been completed. You should also set a default value in the XML for the preferences.

提交回复
热议问题