Ron95
Ron95

Reputation: 146

Picasso Image not always loading - Android

I am trying to set the ImageView to the image contained in the URL, it is done in the list adaptor class which loads an image for each item in list.

    Picasso.with(context).load("http://192.168.0.XX:8000"  + e.getImageURL()).into(eventImage);

I can see that the request is not always being sent to my local backend, but if I scroll the screen they might then load. The IP address and URLs are correct.

Upvotes: 0

Views: 79

Answers (1)

Shantanu
Shantanu

Reputation: 1221

Use a listener to figure out the error or handle the case in which the image doesn't load,

Picasso.Builder builder = new Picasso.Builder(context);

builder.listener(new Picasso.Listener()
{
    @Override
    public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception)
    {
        exception.printStackTrace();
    }
});

builder.build().load(imageUrl).placeholder(R.drawable.ic_placeholder).into(mImageView);

Upvotes: 1

Related Questions