毕加索错误。图像URL来自数据库但未在毕加索图像中设置

时间:2018-02-19 05:53:01

标签: picasso

Picasso.with(context).load(Image.get(position))。into(new Target(){@Override public void onBitmapLoaded(Bitmap bitmap,Picasso.LoadedFrom from {Log.d(" abhinav1& #34;," onBitmapLoaded:" + bitmap); r.setBackground(new BitmapDrawable(bitmap));} @覆盖public void onBitmapFailed(Drawable errorDrawable {} @ Override public void onPrepareLoad(Drawable placeHolderDrawable){ }});

2 个答案:

答案 0 :(得分:0)

搜索后,我发现数据来自字符串中的服务器,然后您首先必须将字符串解密为位图,然后在imageview中设置

答案 1 :(得分:0)

在onBitmapLoaded方法中,您可以使用

   @Override
     public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom >from) {
         Log.d("abhinav1", "onBitmapLoaded: "+bitmap);
         r.setBackground(new BitmapDrawable(context.getResources(), bitmap));
     }

请在Resources构造函数中传递BitmapDrawable