What I have: a custom listview with Textviews and checkbox.
You are setting the tag of the checkbox only if convertview is null. This happens only for the first screen of records. When user scrolls down, the previous convertviews are recycled. Thus your checkboxes have older data items as their tags.
Your checked change listener should look like this:
new CompoundButton.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked)
{
Person element = (Person) viewHolder.checkBox.getTag();
data[position].setCheck(isChecked);
if(isChecked)
{
// do your stuff
}
else
{
//to-do
}
}
}