Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
238 views
Welcome To Ask or Share your Answers For Others

1 Answer

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...