Java – Android saves the state of a multi-select ListView

Android saves the state of a multi-select ListView… here is a solution to the problem.

Android saves the state of a multi-select ListView

I have a ListView with some values that have multipleChoice enabled in my xml file.
I want to be able to save what the user checked when the app exits, and then recheck what they selected when opened again. My code works for broadcast groups, but I can’t seem to get it to work for this.

EDIT: Make this work fine by using some for loop tricks at the end.

Solution

You can use SharedPreferences to save your selections.

Related Problems and Solutions