Wired Image loading issue in Picasso

与世无争的帅哥 提交于 2019-12-13 09:28:48

问题


I am using Picasso whose dependency is added in the gradle file

compile 'com.squareup.picasso:picasso:2.5.2'

This is My class

public class ImageLoader {
    private Picasso mPicasso;
    private static ImageLoader mInstance;

    public static ImageLoader getInstance(Context context) {
        if(mInstance==null)
            mInstance = new ImageLoader(context);

        return mInstance;
    }

    private ImageLoader(Context context) {
        mPicasso = new Picasso.Builder(context).build();
    }
    private Picasso getImageLoader(Context context) {
        return mPicasso;
    }
    public void loadImage(ImageView imageView,String url) {
        mPicasso.load(url).into(imageView);
    }


}

And I am invoking the method like this

ImageLoader.getInstance(context).loadImage(holder.imgeView, url);

The issue is that it is loading the image on emulator but not on the mobile device. What is problem ?


回答1:


Try Glide library. I had the same problem using Picasso.

Libraries to include

dependencies {
    compile 'com.github.bumptech.glide:glide:3.5.2'
    compile 'com.android.support:support-v4:22.0.0'
}

Glide.with(context)
    .load("http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg")
    .into(ivImg);



回答2:


It looks like your wifi on mobile don't has access to fetch those images,

so most probably a access permission issue



来源:https://stackoverflow.com/questions/32010015/wired-image-loading-issue-in-picasso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!