Refreshing a specific list-item in ListView

by Aaron D'Souza » Tue, 26 May 2009 08:08:55 GMT


Sponsored Links
 Hey folks,

Simple situation:
- ListActivity with an adapter that inflates a small view for each
list item.

Part of each list-item is an ImageView that might need to be populated
by a thumbnail that is pulled across the network (and then
subsequently cached). I intend to do the fetching in a separate
AsyncTask and to cache a reference to the specific ImageView to be
populated within the AsyncTask. This didn't seem to work (images got
added into the wrong list-items). I suspect it's because I'm reusing
the "convertView" Views that are passed into getView() on my adapter,
and by the time the thumb is downloaded, the ImageView reference I've
cached is now in re-use by a different list-item (can someone
confirm?).

The alternative would be to have a notification mechanism for a
specific *position* in a list, but there doesn't seem to be a way of
notifying a specific list-item to update itself. Searching for
[refresh specific list item] brings up this bug:
 http://code.google.com/p/android/issues/detail?id=227 , but I don't
know if there's been any progress on that.

Any ideas? Let me know if there's any other information I should
provide.

Thanks!
Aaron

--~--~---------~--~----~------------~-------~--~----~