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

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



Other Threads

1. glGenTextures going crazy on actual device

Looks like you cut the original post in your reply so I am not sure what 
the exact problem is but here are some gotchas.


- make sure your context is valid. Milestone eglChooseConfig doesn't work correctly. - are you calling from the same thread? - a negative id isn't invalid since I suspect the int is really a unsigned int - check return codes for errors for all your EGL calls Leigh
Could anyone check what glGenTextures() generates? I still can't find any solution to this problem, and putting every possible texture into a big one is no option for me. Something must be going on here :S I'm running Android 2.1-update1 on my Motorola Milestone if that's important. Other games seems to work flawlessly with (at least that's what I think) way more than just 4 textures :)
-- Leigh McRae www.lonedwarfgames.com --

2. Update ongoing notification only when notification window shown?

Nathan,

Have you considered doing away with detailed progress info in the notification pulldown? The pulldown (Notification) could just indicate that there are downloads in progress, perhaps their total number. Then upon the user clicking on the notification item, you could display an activity with detailed information, which would be updated in real time. This is inspired by what Android Market does, perhaps it's a viable option for your app as well? -- Kostya 05.06.2010 0:27, Nathan :
Is there any way to detect whether the Notification Windows is being shown? I have a service that updates an ongoing notification, complete with a progress bar and text? Is there a way to know if the notifiication screen is actually being shown, so I can adjust how often I wouldn't be so concerned if not for the fact that the HTC Incredible will reboot after it receives several hundred or so updates. Based on a controlled experiment with a beta tester, the service could continue for 24 hours if it did not update progress, but dies after several hundred updates. So I am desperate to reduce the notifications, if that's what works, and one of the ways I could do that is by not updating as much or at all if that screen isn't being shown. Nathan
-- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --

3. Update ongoing notification only when notification window shown?

4. Partial Android Port to Digi ConnectCore (arm9) + Touchscreen

5. Rumor: HTC Scorpion and all of its 1.5 Ghz, Android 2.2 goodness headed for Verizon?

6. Why is making orientation configChanges manually frowned upon?

7. minimum Android 2.2 (froyo) hardware requirements?