如何从服务器下载图像如果使用Asynctask存储在ArrayList中的URL?

问题描述 投票:0回答:1

服务器中的图像,我必须从服务器下载图像。 Image Url使用Asynctask存储在ArrayList中。

如何从ArrayList URL下载图像?我使用Download manager和自定义下载,但它没有给出实际的响应。

android image arraylist android-asynctask
1个回答
0
投票

你可以使用Picasso库。

for (String url : urlList) {
Picasso.with(this)
.load(url)
.into(new Target() {
    @Override
    public void onBitmapLoaded (final Bitmap bitmap, Picasso.LoadedFrom from){
        /* Save the bitmap or do something with it here */

        //Set it in the ImageView
        theView.setImageBitmap(bitmap); 
    }
});
}
© www.soinside.com 2019 - 2024. All rights reserved.