使用毕加索下载图像时,没有向HAL提供足够的数据

时间:2018-03-06 12:00:28

标签: java android image picasso

我正在尝试将Picasso下载到internal storage,但它显示没有向HAL提供足够的数据。

public void downloadImage( String url) {

    String filename= UUID.randomUUID().toString()+".jpg";

    Picasso.with(getApplicationContext()).load(url)
            .into(new Imagedownloader(anime_relativelayout,lottieAnimationView,
                    getApplicationContext().getContentResolver(),filename,"image desc"));


}

public class Imagedownloader implements Target {

  private RelativeLayout anime_relativelayout;
  private LottieAnimationView lottieAnimationView;
  String name;
  String desc;



  public Imagedownloader(RelativeLayout anime_relativelayout, LottieAnimationView lottieAnimationView,
                       ContentResolver contentResolver, String filename, String s) {

    this.contentResolverWeakReference = new WeakReference<ContentResolver>(contentResolver);
    this.name = filename;
    this.desc = s;
    this.lottieAnimationView=lottieAnimationView;
    this.anime_relativelayout=anime_relativelayout;
  }

  @Override
  public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {

    ContentResolver resolver=contentResolverWeakReference.get();
    //AlertDialog dialog=alertDialogWeakReference.get();

    MediaStore.Images.Media.insertImage(resolver,bitmap,name,desc);


    //lottieAnimationView.pauseAnimation();
    //anime_relativelayout.setVisibility(View.GONE);
    //dialog.dismiss();

  }

  @Override
  public void onBitmapFailed(Drawable errorDrawable) {

  }

  @Override
  public void onPrepareLoad(Drawable placeHolderDrawable) {

  }
}

0 个答案:

没有答案