Hello -

I'm trying to figure out the best design pattern to use here.

I have a list view, for which each row consists of some text and an
image. This content must be downloaded from the web. Currently, the
list view is using a custom adapter, and I implemented the getView()
method to dynamically download the image as it is needed (i.e. as the
row on which it should be displayed becomes visible).

This is all happening in the main thread, and it's having an impact on
the user experience. So I'd like to move the downloading of the image
to the background thread. I know how to do this ... but my quandary is
then, how do I pass the image information back to the main UI thread.
AFAIK, the most convenient way to pass information between threads is
using Handler.sendMessage() and including a bundle with the message
containing any information. But I don't think it's possible to include
an Image as part of a bundle, because it's not serializable.

Do I need to write the image to disk and pass a string containing the
file path? what are some other ways I could go about passing
information about a downloaded image from the non-UI background thread
to the ui thread?

Thanks!
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to