Re: [android-developers] Lazy load images into listview

2010-11-08 Thread Aaron Windsor
On Sat, Nov 6, 2010 at 4:42 PM, Open gro...@tenromans.com wrote:
 I have an activity in my application that shows a listview of items
 with icons next two each item. I would like to lazy load icons for
 each item from the Internet using in memory caching and SD caching
 (very common Android use case).

 I have been using this code from the Google Android developers blog:
 http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html

 And discovered that it is possible for this code to generate  100
 asynctasks,

 Does anyone have a modified version of this they would be willing to
 share using a threadpool or some other mechanism to limit the number
 of background threads?

I've used droid-fu (http://github.com/kaeppler/droid-fu/) for exactly
what you're describing, specifically the ImageLoader class within a
custom adapter. Whenever the ListView calls getView on the adapter,
you instantiate an ImageLoader, passing the ImageView that you want to
populate with your web image and the intended position in the ListView
as arguments.

droid-fu also has a WebImageView which looks like it has some recent
changes that will allow it to be used as a drop-in replacement for
ImageViews within ListViews, so you may be able to use it and not even
fool with a custom adapter at all.

-Aaron

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Lazy load images into listview

2010-11-06 Thread Open
I have an activity in my application that shows a listview of items
with icons next two each item. I would like to lazy load icons for
each item from the Internet using in memory caching and SD caching
(very common Android use case).

I have been using this code from the Google Android developers blog:
http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html

And discovered that it is possible for this code to generate  100
asynctasks,

Does anyone have a modified version of this they would be willing to
share using a threadpool or some other mechanism to limit the number
of background threads?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en