Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used before setListAdapter with simple_multiple_choice to make listview with checkboxes.

And then I did to get size and chosed positions:


XML
SparseBooleanArray checked = list.getCheckedItemPositions();
cont = list.getCheckedItemPositions().size();

if (checked.get(i))
{
...

But now I needed more control on the layout, so i'm doing the listview on the xml, something like:
<listview>
<checkboxes id=.../>
</listview>


using setAdapter to those ids.

The listview is correctlyt populated (as before), problem is, now the SparseBooleanArray don't work. Thar variable 'cont', gives me 0, and 'checked' is null.

To make sure that 'list' is ok:

int len = list.getCount();


It gives me a right value.

What's the problem?
Posted

1 solution

 
Share this answer
 
Comments
Maxdd 7 12-Sep-11 14:35pm    
Unfortunately that thread does not help because for me, list.getCheckedItemPositions(); is always null. However list itself is not, it has all the elements...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900