简体   繁体   中英

Removing array tags on multilistpreference summary

I have a MultiSelectListPreference() set up. My issue isn't displaying the checked value as summary but removing tags of the array when a value is checked.

Summary of the preference are like this using the below code:

[Adam, Atom, Berry]

But my desired result should be like this when the correct entry is checked as summary:

Adam, Atom, Berry

Here is what I have so far that gives me the array tags "[ ]"

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
 Set<String> selections = preferences.getStringSet("rssfeeds", null);
 String[] selected= selections.toArray(new String[] {});
ssid.getSummary(selected.toString());

Any pointers achieving this??

For those that will encounter this in the future, I solved this by looping through the selections then using a StringBuilder() to store each checked box input from the user. I however removed the array tags by just doing replace(old char, new char) where the old char is the tag and the new char is just an empty space "".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM