lundi 23 mars 2015

select all checkbox using the contextual action bar (CAB)?

I have a listview with 20 checkbox and I want select all using a contextual action bar, but my code doesn´t work!



case R.id.selectallcheckbox:

//this show 20
Toast.makeText(getApplicationContext(),Integer.toString(list.getCount()),Toast.LENGTH_SHORT).show();

list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

for ( int i=0; i < list.getCount(); i++)
{
list.setItemChecked(i,true);
}

return true;


The listview is set with an customarrayadapter. If I can get the count list why i can´t set the setItemChecked. Only get the square of checkbox change of colour but it´s not checked with a TIC.





Aucun commentaire:

Enregistrer un commentaire