Link to home
Start Free TrialLog in
Avatar of jagku
jagkuFlag for United States of America

asked on

maintaining the state of checkboxes on android listviews

Hello Experts,

I am using a listview with checkboxes.

I manually set the the checkboxes.

I want to pre-set the checkboxes again when I come back to the listview.

Please can you give me the command to programatically set the checkboxes when the listview is re-loaded (I know how to store the details of the checkboxes that were checked).

Many Thanks!
Avatar of Molnár István
Molnár István
Flag of Romania image

Avatar of jagku

ASKER

Thank you.  However, I would like to clarify that I am trying to set the checkboxes that come with a listview. (They are not checkboxes that i have created in a layoutfile)
Hi jagku,

Use the
SparseBooleanArray sparseBooleanArray = myList.getCheckedItemPositions();

This method will return the selected state  of the ListView.

Refer this link for some samples...
http://android-coding.blogspot.in/2011/09/listview-with-multiple-choice.html

Regards
Santhana
ASKER CERTIFIED SOLUTION
Avatar of jagku
jagku
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jagku

ASKER

See above answer