Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PreferenceScreen android:summary update !

Tags:

android

In my android application I have a PreferenceScreen parent that has 3 CheckBoxPreferences as children.

When I click the parent preferenceScreen, and the 3 checkboxes are displayed, I select one of them, and in the Preference.OnPreferenceChangeListener asociated with the checkboxes I set the parent's preferenceScreen summary with:

Parent.setSummary("string depending on the selection")

The thing is that when I return to the parent, it's summary is not updated, even if internally the value has correspondingly changed to the value setted.

Has anyone any idea regarding this behavior?

like image 225
klaus johan Avatar asked Mar 07 '10 12:03

klaus johan


1 Answers

Use

Parent.setSummary("string depending on the selection");
((BaseAdapter)getPreferenceScreen().getRootAdapter()).notifyDataSetChanged();

works like a charm and can be used regardless the place you change the summary.

like image 133
halxinate Avatar answered Sep 22 '22 06:09

halxinate