Android - Picasso misses pictures sometimes
Asked Answered
D

1

1

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);
                }
            });
Dominga answered 16/2, 2016 at 13:26 Comment(1)
I am also facing this problem? Any ANswer would be Life Saver !Instantaneous
E
1

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.

Earthbound answered 16/2, 2016 at 13:49 Comment(1)
Thanks for your reply. I am still getting 'SkImageDecoder::Factory returned null Error' for some picturesDominga

© 2022 - 2024 — McMap. All rights reserved.