Reputation: 105
I have a listview that contains some values with the multipleChoice enabled in my xml file. I want to be able to save what has been checked by the user when the app is exited, then re-check what they have selected upon opening again. My code works for a radio group, but I can't seem to get it to work for this.
EDIT: Got this working by using some for loop trickery at the end.
Upvotes: 4
Views: 725
Reputation: 19220
as @BGS wrote, SharedPreference would solve your problem. Check out this post: MultiChoice Preference Widget for Android.
Here the values of the checkboxes are stored in a [special-separator]-separated string, and passed to the caller as a String array containing the selected values.
I'm using this approach, and it works great so far.
Upvotes: 1