complex listeviewitem image load hang application problem

I am suing Listview and customize listview to display image inside a list item. I want display image with every search result.

to display complext listeim i am following the following example

inside wrapper class i am initiating new thread for every new list item's image so that i won't dealy the displaying image.

my code is below

new Handler().post(new Runnable(){
                   public void run() {
                Drawable dImage = Util.getImageFromURL(imageURL); 


mean 10 images initiates 10 different image loading threads other static data is not inside thread.

problem arises when during image loading page application getting hang it should not hang.... any idea what to do ?

alt text

Asked by: Emily198 | Posted: 25-01-2022

Answer 1

Use a background operation to retrieve your images, such as an AsyncTask. All your new Handler().post() stuff does is delay the work by a nanosecond, not have it be performed in the background.

Also, if you are going to use Handlers, just create one.

Answered by: Roman426 | Posted: 26-02-2022

Similar questions

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android