问题
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