Reputation: 6222
I created an android preference page and wanted to show the current option selected in the summary.
So I implemented the onSharedPreferenceChanged listener which is also called correctly. However, there is no screen change and the old option is shown.
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
// just update all
ListPreference lp = (ListPreference) findPreference(PREF_DOWNLOAD_WEB);
lp.setSummary(getString(R.string.pref_listDownloadWebSummary) + ": %s");
}
Is this a known bug?
Upvotes: 1
Views: 937
Reputation: 6222
I noticed that the updated summary is shown when I set another prefs summary. So I set the summary to "dummy" first and then the real string. It works too.
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
// just update all
ListPreference lp = (ListPreference) findPreference(PREF_DOWNLOAD_WEB);
lp.setSummary("dummy"); // required or will not update
lp.setSummary(getString(R.string.pref_listDownloadWebSummary) + ": %s");
}
Upvotes: 2