1. Check out our app, Forums for Android! Download and leave feedback here!

Getting checked state of ListView checkbox

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

  1. andywhoa

    andywhoa Well-Known Member
    Thread Starter
    38

    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 Well-Known Member
    53

    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...