Android listview with checkbox problem Android listview with checkbox problem android android

Android listview with checkbox problem


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 methodthen put condition:

if (isChecking==true){checkbox1.setChecked(true);}else{checkBox1.setChecked(false);}