Picasso Images not loading in a GridView

JamieB

I am having issues with Picasso, I have a custom adapter loading images by the following:

Picasso.with(this.ctx).load(contact.getPhotoURI()).placeholder(R.drawable.contact_no_picture).into(img);

This is loaded into an ImageView which is placed inside a GridView.

The result is the following:

enter image description here

As you can see the images are half loaded and in some cases, not loaded at all.

Am I missing something?

rekaszeru

When using Picasso with item renderers in a list / grid, I ended up using the ListeningTarget interface the lib provides:

Create a custom class that extends ImageView and implements ListeningTarget.

public class PicassoImageView extends ImageView implements ListeningTarget
{...}

In the overridden onBitmapLoaded method call this.setImageBitmap(bmp); where bmp is the parameter Picasso passes as the loaded image's bitmap:

@Override
public void onBitmapLoaded(Bitmap bmp, LoadedFrom loadedFrom)
{
    Log.d("Picasso", "Image loaded");
    this.setImageBitmap(bmp);
}

Use this class for the img instance in your layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" ...>

    [...]
    <com.your.packagename.PicassoImageView
        android:id="@+id/renderer_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" ... />
    [...]
</RelativeLayout>

And initialize it like:

PicassoImageView img = (PicassoImageView) findViewById(R.id.renderer_icon);

Change your call to Picasso to:

Picasso.with(this.ctx).load(contact.getPhotoURI())
    .placeholder(R.drawable.contact_no_picture)
    .into((ListeningTarget)img);

Of course it's not necessary to have the ImageView implement the ListeningTarget, but I found it easier than searching for the right view every time a bitmap is loaded by Picasso.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Picasso Images not loading in a GridView

From Dev

Picasso Images are not loading in Gridview Android

From Dev

Picasso Library and GridView Images

From Dev

Picasso loading duplicate images

From Dev

Android : Picasso is not loading some images

From Dev

Loading multiple images with Picasso on background

From Dev

Slow Loading big images with Picasso

From Dev

Picasso image loading previously cached images

From Dev

Loading images from disk with picasso, does it cache it?

From Dev

Loading Images With Picasso From The Internal Storage

From Dev

Picasso Images are loading slow in android, why?

From Dev

Picasso Images are loading slow in android, why?

From Dev

Images not loading using Picasso no error given

From Dev

Picasso is not loading the images from url with custom adapter

From Dev

Picasso isn't loading scrolled images efficiently?

From Dev

OutOfMemoryError when loading images into GridView

From Dev

Loading multiple images to gridview android

From Dev

Loading images from URLs into gridview

From Dev

Loading multiple images to gridview android

From Dev

OutOfMemoryError when loading images into GridView

From Dev

Loading images from URLs into gridview

From Dev

Loading images in a gridview with async task, not loading correctly

From Dev

Load Images from Phone storage to GridView using Picasso

From Dev

Large images (from file) not loading in Picasso, no obvious error seen

From Dev

Picasso library is not loading images from the server correctly in a listview

From Dev

Loading images using web service and Picasso, how to add inSampling size?

From Dev

Picasso image loader: loading updated images from url

From Dev

loading images from array list using picasso library

From Dev

Loading images in GridView using Universal Image Loader

Related Related

  1. 1

    Picasso Images not loading in a GridView

  2. 2

    Picasso Images are not loading in Gridview Android

  3. 3

    Picasso Library and GridView Images

  4. 4

    Picasso loading duplicate images

  5. 5

    Android : Picasso is not loading some images

  6. 6

    Loading multiple images with Picasso on background

  7. 7

    Slow Loading big images with Picasso

  8. 8

    Picasso image loading previously cached images

  9. 9

    Loading images from disk with picasso, does it cache it?

  10. 10

    Loading Images With Picasso From The Internal Storage

  11. 11

    Picasso Images are loading slow in android, why?

  12. 12

    Picasso Images are loading slow in android, why?

  13. 13

    Images not loading using Picasso no error given

  14. 14

    Picasso is not loading the images from url with custom adapter

  15. 15

    Picasso isn't loading scrolled images efficiently?

  16. 16

    OutOfMemoryError when loading images into GridView

  17. 17

    Loading multiple images to gridview android

  18. 18

    Loading images from URLs into gridview

  19. 19

    Loading multiple images to gridview android

  20. 20

    OutOfMemoryError when loading images into GridView

  21. 21

    Loading images from URLs into gridview

  22. 22

    Loading images in a gridview with async task, not loading correctly

  23. 23

    Load Images from Phone storage to GridView using Picasso

  24. 24

    Large images (from file) not loading in Picasso, no obvious error seen

  25. 25

    Picasso library is not loading images from the server correctly in a listview

  26. 26

    Loading images using web service and Picasso, how to add inSampling size?

  27. 27

    Picasso image loader: loading updated images from url

  28. 28

    loading images from array list using picasso library

  29. 29

    Loading images in GridView using Universal Image Loader

HotTag

Archive