I am using my custom adapter. Each line has a check box and a text view. But I have a problem. The list contains more items than the number that fits the screen.
Therefore, when I check any flag on the screen and scroll down. Automatically uncontrolled.
When I scroll again, some random flags are checked.
I know that in the list getView () is updated again and again, and the problem is in the position. But I do not know the solution.
I tried using a boolean array to save the track. but dnt knows how to do it right.
cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){ @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { itemChecked[index]=isChecked; } }); cb.setChecked(itemChecked[index]);
Can you post a snippet of code and explain it in detail. I am tired of looking for this since the last 2 weeks ... thanks in advance, ..
source share