1. Are you ready for the Galaxy S20? Here is everything we know so far!

Getting checked state of ListView checkbox

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

  1. Deleted User

    Deleted User Guest
    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
  2. cp1

    cp1 Android Enthusiast

    Are all the checkboxes their own view items, or are they grouped either together, or as part of your list?
     
Loading...
Similar Threads - Getting checked state
  1. nickdalzell
    Replies:
    15
    Views:
    441
  2. GST GridTech
    Replies:
    0
    Views:
    334
  3. AugieTN
    Replies:
    24
    Views:
    886
  4. Noteworthy
    Replies:
    2
    Views:
    591
  5. Dréa345
    Replies:
    1
    Views:
    391
  6. JohnJSal
    Replies:
    5
    Views:
    736
  7. Biffos
    Replies:
    10
    Views:
    577
  8. Sunny Rio
    Replies:
    3
    Views:
    601
  9. Theydonboy
    Replies:
    2
    Views:
    467
  10. yasar2002
    Replies:
    2
    Views:
    1,086

Share This Page

Loading...