Getting checked state of ListView checkbox


Last Updated:

  1. andywhoa

    andywhoa Well-Known Member This Topic's Starter

    Joined:
    May 15, 2010
    Messages:
    105
    Likes Received:
    13
    Hi,

    I have a ListActivity and each item in the ListActivity contains a checkbox. I've extended ArrayAdapter and I have an ArrayList var which is the data associated with each item in the list. One of the pieces of data stored in this ArrayList is whether the item is checked or not. When the user checks a checkbox, I want to update the corresponding index in my ArrayList so it knows that checkbox is checked. Can someone help me out with the syntax needed for this?

    Ultimately I'm enabling/disabling a menu item based on whether or not any checkboxes in the list are checked; so I'm looping through my adapter's ArrayList to check the checked state, but I need to make the check state update first.

    Like I was thinking of overriding the checked handler, but how would I know which index it's at? I'm a bit confused.

    Thanks
     

    Advertisement
  2. cp1

    cp1 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
    Are all the checkboxes their own view items, or are they grouped either together, or as part of your list?
     

Share This Page

Loading...