Downloading multiples images from Picasso in Android

前端 未结 6 1922
被撕碎了的回忆
被撕碎了的回忆 2021-02-09 14:59

I\'m using Picasso library to download images from URL. This is my first attempt on Picasso

Scenario : I want to download some images from server and store them into a

6条回答
  •  太阳男子
    2021-02-09 15:28

        final ImageView iv = new ImageView(context);
    
        Picasso.with(context).load(resultImageUrl).into(iv, 
           new Callback() {
               @Override
               public void onSuccess() {
                  // Picasso successfully loaded image from resultImageUrl
    
                  Bitmap bitmap = ((BitmapDrawable) 
                  iv.getDrawable()).getBitmap();
    
                  ImageStorage.saveToSdCard(context, bitmap, imageName);
    
                  onFinishDownloading(results);
               }
    
               @Override
               public void onError() {
                  // Picasso has failed to load image from resultImageUrl
    
                  onFinishDownloading(results);
               }
        });
    

提交回复
热议问题