1

I'am working on an android application, which gets summary of a preference from shared Preferences and now I have to set these values to this dialog box of the MultiSelectListPreference.

I am getting something like this (the summary is correct but the dialog values are not checked)

enter image description here

The code I used to bind the summary with value change(working fine):

        objects.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                String values;
                objects.setSummary(newValue.toString());
                values = newValue.toString().replace("[", "");
                values = values.replace("]", "");
                editorObjects.putString(UserSharedPref.objectList, values);

                editorObjects.commit();
                return true;
             }
         });

The values and summary is binded in the above example.

I'am initializing values from user shared prefs like this (working fine):

objects.setSummary(["+UserSharedPref.initializeSharedPreferencesForObjectList(getApplicationContext()).getString(UserSharedPref.objectList, "person,bicycle,motorcycle,car,bus,truck") + "]");

But, to check the values based on this summary is where I'am getting the problem. How should my approach be?

Sonic_
  • 347
  • 3
  • 9

0 Answers0