I am using my custom adapter. There is a checkbox and a text view in each row. But i have a problem. There are more items in the list than the number which fits on the screen.
So when i check any of the checkboxes on the screen and scroll down. The automatically get unchecked.
When i scroll up again some random checkboxes get checked.
I know that in getView() list is being refreshed again and again and theres an issue of the position. But dont know the solution.
I have tried using a boolean array to keep a track. but dnt know how to do it properly.
cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
itemChecked[index]=isChecked;
}
});
cb.setChecked(itemChecked[index]);
Can you please post some code snippet and explain in detail. i am tired of searching this since last 2weeks... thanks in advance,..
set each check box position using settag(position) in getview() method and while clicking each checkbox get the position by (Integer)buttonView.getTag(). I think below code will solve your issue.