• 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!
  • 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)
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...

jagkuAuthor Commented:

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

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

jagkuAuthor Commented:
See above answer
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