imageview draw issue with asynctask
Posted
by
alexb
on Stack Overflow
See other posts from Stack Overflow
or by alexb
Published on 2012-05-30T23:13:15Z
Indexed on
2012/05/31
4:40 UTC
Read the original article
Hit count: 176
android
Have the following asynctask that i'm using to download some images. Works fine except for the very first image, which doesn't always appears unless I do something like move to the next image and then back again.
public class DownloadImageTask extends AsyncTask { static ImageView _imageView=null;
public DownloadImageTask(ImageView ctl){
_imageView=ctl;
}
protected void onPostExecute(Bitmap result) {
_imageView.setImageBitmap(result);
}
...
}
I thought this might be an issue with updating the UI on a background thread, so I reworked this using an abstract class that invokes a method on the UI thread that calls .setImageBitmap() but I still get the same behaviour - works fine for all images except the first, unless I move to the next image and back again.
Is there a way to force a redraw on the imageview after i set the image?
© Stack Overflow or respective owner