• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 620
  • Last Modified:

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!
0
jagku
Asked:
jagku
  • 3
1 Solution
 
jagkuAuthor Commented:
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)
0
 
SanthanaTechnical LeadCommented:
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
0
 
jagkuAuthor Commented:
Hello,

Thank you for all your responses.
Unfortunately, this hasn't answered the query.

To get this working, I by creating a custom adaptor.

Thanks!
0
 
jagkuAuthor Commented:
See above answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now