Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

java - Wired Image loading issue in Picasso

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

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

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...