Iterating ListView items in Android
Posted
by
pocoa
on Stack Overflow
See other posts from Stack Overflow
or by pocoa
Published on 2011-01-17T05:36:29Z
Indexed on
2011/01/17
5:53 UTC
Read the original article
Hit count: 183
I want to iterate a list of items into a ListView. This code below is not enough to iterate all the items into the list because of the weird behaviour of getChildCount() function which only returns the visible item count.
for (int i = 0; i < list.getChildCount(); i++) {
item = (View)list.getChildAt(i);
product = (Product)item.getTag();
// make some visual changes if product.id == someProductId
}
My screen displays 7 results and when there are more than 7 items into the list, it's not possible to access to the 8th item or so.. Only visible items..
Should I use ListIterator instead?
Thanks.
© Stack Overflow or respective owner