I have a weird problem! I\'m trying to create a listview with checkboxes. In my other thread I was told that I should use an array that keeps track of the rows that are chec
This was tricky.
The problem is that you are calling setChecked
, activating the old OnCheckedChangeListener
.
The fix is quite simple: call setOnCheckedChangeListener
before calling setChecked
. This way you sever the link to the old listener from the recycled view.
Check this for Single selection of Checkbox
in Listview
AdpList adapter=new AdpList(this,array,false);
listview.setAdapter(adapter);
When you select any Item then on item CLickListener
do as Follows
listview.setonItemClickListener(new OnItemClickListener)
Here You will Get the Position of the Current Item
array.get(Position);
Get the Checkbox view and On clicking the Checkbox, create a method in Adapter, Like
adapter.setList(true);
adapter.notifyDataSetChanged();
And In Adapter check the Parameter that I have Passed in the Setlist
method
then put condition:
if (isChecking==true)
{
checkbox1.setChecked(true);
}else{
checkBox1.setChecked(false);
}