What I Have
I have a ListView showing the files on a device. I have a hidden ImageView which I want to make VISIBILE when an user clicks the "Select All" button.
The Issue
When the user clicks the select all button, all the items are not selected. When I scroll down, I find some items have not been selected (there image view is still INVISIBLE).
My Code
selectAll.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
List<Item> selectList = dir;
for (int i = 1; i < list.getChildCount(); i++) {
tmpView = list.getChildAt(i);
select = (ImageView) tmpView.findViewById(R.id.fileSelect);
select.setVisibility(View.VISIBLE);
}
for (int i = 1; i < selectList.size(); i++) {
Item o = adapter.getItem(i);
o.setSelected();
}
}
});
Please suggest how to solve this problem? I know that the ListView items are reused and that is actually causing the problem, but I do not know how to solve this problem.