Android: best way to load images in background -


For my custom list view, I am using AsyncTask for web service calls and it is working fine . In my list view there is a left-hand image, title, description. The service will return a list of (url, title, desc).

And in my adapter, I am loading images using the following code:

 httpClient = new DefaultHttpClient (); HttpGet Request = New HttpGet (url); Feedback = httpClient.execute (request); InputStream = response.getEntity () GetContent (); Drawable drawable = Drawable.createFromStream (is, "src"); ImgView.setImageDrawable (drawable);  

But I can not see the list view until all the images are loaded, I know that I am blocking the UI thread, without any UI blocking it Can recommend the best way.

Thanks, Venkat Papana

a asyncTask or

BitmapRedgetable BitmapDribal = New Bitmap Drauble (bitmapfile.onestream (new URL ("http://example.com/path/to/image/file.jpg") .openstream ())); Create <

1 AsyncTask , and in doInBackground , loop through all of your image URLs, and each resulting dropable in the icon list Add, or something

Comments