picasso: Image not loading in RecyclerView

HI, I’m trying to load list of images from server in to a recycler view, some images are not loading. but when I try to load it in an ImageView that is not in a RecyclerView it load’s perfectly. one effected image I uploaded here.

my code is :

                Picasso.with(mContext).load(imageUrl)
                        .transform(new RoundedRectTransformation(cornerRadius, 0))
                        .fit().centerCrop().into(viewHolderOffer.mOfferImage);

I have saw issue reported for older version of Picasso, but I’m using the latest version 2.5.2

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

I am also having issues with Picasso loading images in a RecyclerView.

When I run Picasso.with(mImageView.getContext()).load(mPhotoUri).resize(37, 37).into(mImageView); or Picasso.with(mImageView.getContext()).load(mPhotoUri).noFade().into(mImageView);

The ImageView is simply blank. Like it never loaded.

Then when I run Picasso.with(mImageView.getContext()).load(mPhotoUri).noFade().placeholder(R.drawable.placeholder).into(mImageView); (same thing with placeholder image) I get an imageview with the placeholder, but image does not load.

I debugged the app to see value of mPhotoUri then did an adb pull on that path with success. Image does exist.

I also replaced the Picasso line with mImageView.setImageBitmap(UriUtil.getBitmapFromUri(photo)); where UriUtil.getBitmapFromUri() is:

    public static Bitmap getBitmapFromUri(Uri uri) {
        File image = new File(uri.getPath());

        return BitmapFactory.decodeFile(image.getAbsolutePath());
    }

and this works. Image loads no problem. However, it doesn’t look good because its not centered, fitted, etc. like I want Picasso to do for me.

Here is my ImageView

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

       <ImageView
        android:id="@+id/image_for_picasso"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/ic_placeholder" />

</merge>

I am using merge here for a custom view I’m setting inside of the RecyclerView row.

Can you try the 2.6.0-SNAPSHOT?