Android的 - 毕加索错过的图片有时 [英] Android - Picasso misses pictures sometimes

查看:292
本文介绍了Android的 - 毕加索错过的图片有时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的毕加索库使用以下code下载图像,我已经通过调整他们转型为圆形加载在一个循环中许多照片。有时图像加载成功,有时onError方法被调用,而不是在的onSuccess回调。而我得到这个错误 SkImageDe codeR ::厂返回null错误。当我卸载该应用程序,然后重新安装后,图像加载成功居多。这是什么问题准确,善意提出任何解决办法。

code:

  INT DP =(int)的resources.getDimension(R.dimen.marker_pic_size);
    Picasso.with(上下文).load(profilePic_url)
            .transform(新CircleTransform())
            .resize(DP,DP)
            .into(tempView,新的回调(){
                @覆盖
                公共无效的onSuccess(){
                Log.d(usm_onSuccess,profilePic_url);
                  }                @覆盖
                公共无效onerror的(){
                    Log.d(usm_onError,profilePic_url);
                }
            });


解决方案

通过使用的目标中它可能会解决你的问题。

 目标=新目标(){
@覆盖
在prepareLoad公共无效(绘制对象绘制){}@覆盖
公共无效onBitmapLoaded(位图位图,LoadedFrom ARG1){
    如果(位图!= NULL){
        tempView.setImageBitmap(位图);
    }
}@覆盖
公共无效onBitmapFailed(绘制对象绘制){}
};

...

  INT DP =(int)的resources.getDimension(R.dimen.marker_pic_size);
    Picasso.with(上下文).load(profilePic_url)
            .transform(新CircleTransform())
            .resize(DP,DP)
            .into(目标);
tempView.setTag(目标);

据了解问题。你可能又见<一个href=\"http://stackoverflow.com/questions/30503625/images-are-not-loading-in-android-5-0-using-picasso-library\">this获得更多的想法。

I am using Picasso library for images downloading using the following code, I've to load many pictures in a loop by resizing them and transforming to circular. Sometimes images are successfully loaded and sometimes onError method is called instead of onSuccess in Callback. And i get this error SkImageDecoder::Factory returned null Error. When i uninstall the app then after reinstalling images are loaded successfully mostly. What is the problem exactly and kindly suggest any solution.

Code:

int dp = (int) resources.getDimension(R.dimen.marker_pic_size);
    Picasso.with(context).load(profilePic_url)
            .transform(new CircleTransform())
            .resize(dp, dp)
            .into(tempView, new Callback() {
                @Override
                public void onSuccess() {
                Log.d("usm_onSuccess", profilePic_url);   
                  }

                @Override
                public void onError() {
                    Log.d("usm_onError", profilePic_url);
                }
            });

解决方案

By the use of Target it may solve you problem.

target = new Target() {
@Override
public void onPrepareLoad(Drawable drawable) {}

@Override
public void onBitmapLoaded(Bitmap bitmap, LoadedFrom arg1) {
    if(bitmap != null) {
        tempView.setImageBitmap(bitmap);
    }
}

@Override
public void onBitmapFailed(Drawable drawable) {}
};

...

int dp = (int) resources.getDimension(R.dimen.marker_pic_size);
    Picasso.with(context).load(profilePic_url)
            .transform(new CircleTransform())
            .resize(dp, dp)
            .into(target);
tempView.setTag(target);

It is know issue.You may also see this to get more idea.

这篇关于Android的 - 毕加索错过的图片有时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆