1. Download our Official Android App: Forums for Android!

Apps Getting checked state of ListView checkbox

Discussion in 'Android Development' started by andywhoa, Aug 3, 2010.

  1. andywhoa

    andywhoa Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    105
    Joined:
    May 15, 2010

    May 15, 2010
    105
    13
    38
    Software Engineer
    West Des Moines, IA
    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 Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    375
    Joined:
    Apr 30, 2010

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

Share This Page

Loading...