简体   繁体   中英

Set loading bitmap to spinner in progress dialog

I used a tutorial that showed me how to load bitmaps in an async task and set them to an imageview and in the tutorial before the bitmap is loaded the imageview is set to black with this piece of code

static class DownloadedDrawable extends ColorDrawable {
private final WeakReference<DownloadImageTask> bitmapDownloaderTaskReference;

public DownloadedDrawable(DownloadImageTask bitmapDownloaderTask) {
    super(Color.BLACK);
    bitmapDownloaderTaskReference =
        new WeakReference<DownloadImageTask>(bitmapDownloaderTask);
}

public DownloadImageTask getBitmapDownloaderTask() {
    return bitmapDownloaderTaskReference.get();
}
}

How can I change the imageview so that before it is loaded it is the spinner in the progress dialog.

Thanks in advance.

you can try aquery android library for lazy loading image and listview...below code may help you.....

AQuery aq = new AQuery(mContext);
aq.id(R.id.image1).image("http://data.whicdn.com/images/63995806/original.jpg");

You can download library from from this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM