On my Listview have checkbox on each item. And on ListItemClick event i did like this
I want that when click on the Listview item, the checkbox will be checked and if the checkbox hv been checked then un-check them. It's worked fine with the small list (less than 10 items).
public void onListItemClick(ListView parent, View v, int position, long id)
{
position = position - parent.getFirstVisiblePosition() ;
CheckBox cb = (CheckBox) parent.getChildAt(position).findViewById(R.id.checkBox);
if (cb.isChecked())
{
cb.setChecked(false);
}
else
{
cb.setChecked(true);
}
}
And the problem is when the Listview have around 50 items. When i click on the first item then a scroll down a bit the other item also checked. Something like item at position 10, 20 have been auto checked.
Anybody know how come the other item is auto-checked and how to fix it, tks