Picasso not loading the image

arash moeen

here's the code for picasso:

ImageView img = (ImageView)findViewById(R.id.product_image);
    Picasso.with(this)
    .load(_url)
    .fit()
    .into(img, new Callback() {

        @Override
        public void onSuccess() {


        }

        @Override
        public void onError() {


        }
    });

here's the value of _url: http://kiagallery.ir/Images/Upload/Collection%20101/Spring%20101/d4a03b66dc7b46c694615c549b78b2e9.jpg

and here's the xml:

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

<ImageView 
    android:id="@+id/product_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView 
    android:id="@+id/product_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="13sp"
    android:layout_below="@id/product_image"/>

<TextView
    android:id="@+id/product_price"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="13sp"
    android:layout_below="@id/product_name"/>
</RelativeLayout>

as you can see the image can be accessed via browser but picasso fails to load it, I've checked the onError function and it's never called, I'm quiet lost here, any help would be appreciated.

EDIT: When I give imageview's width & height fixed value like 200dp, it loads the image, but when I change it to wrap_content it doesn't show the image.

Luboš Staráček

My guess is you should not call that fit() method in Picasso while your ImageView has its width and height defined by WRAP_CONTENT.

This method wait until the ImageView has been measured and resize the image to exactly match it's size. While your ImageView is having size defined by WRAP_CONTENT, then methods getMeasuredWidth() and getMeasuredHeight() seemingly returns 0 which is making your ImageView invisible.

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 not loading URL into image

From Dev

picasso android image not loading

From Dev

Implementing Picasso not loading image

From Dev

Image loading using picasso on disk

From Dev

How to delay Picasso image loading?

From Dev

Image Slider image not loading (ViewPager + Picasso)

From Dev

Fade in animation while loading image Using Picasso

From Dev

Loading image using Picasso showing colors in corners

From Dev

Picasso image loading previously cached images

From Dev

Picasso not loading updated image from Web in android

From Java

Picasso image loading issue with Android 9.0 Pie

From Dev

Picasso loading of image spawned inside AsyncTask

From Dev

Picasso's image loading using fit() method

From Dev

Android,Picasso. Is not loading an Image from a url

From Dev

Picasso loading image error-Android

From Dev

Picasso image loading issue in GoogleMap.InfoWindowAdapter

From Dev

Picasso only loading one image in a BaseAdapter

From Dev

Picasso image loading issue with Android 9.0 Pie

From Dev

Picasso Image Loading Library, some issues

From Dev

Android: Lazy Loading Image in horizontalscrollview using Picasso

From Dev

Picasso loading image error-Android

From Dev

Android - Picasso removes margin after loading Image

From Dev

Picasso only loading single image but the size is 20

From Dev

Different width when loading same image with Picasso

From Dev

Picasso not loading image from a URL, sometimes

From Dev

Show an "Loading..." image while background loading of image with Picasso

From Dev

Show an "Loading..." image while background loading of image with Picasso

From Dev

Picasso image loader: loading updated images from url

From Dev

Synchronous image loading on a background thread with Picasso - without .get()

Related Related

  1. 1

    Picasso not loading URL into image

  2. 2

    picasso android image not loading

  3. 3

    Implementing Picasso not loading image

  4. 4

    Image loading using picasso on disk

  5. 5

    How to delay Picasso image loading?

  6. 6

    Image Slider image not loading (ViewPager + Picasso)

  7. 7

    Fade in animation while loading image Using Picasso

  8. 8

    Loading image using Picasso showing colors in corners

  9. 9

    Picasso image loading previously cached images

  10. 10

    Picasso not loading updated image from Web in android

  11. 11

    Picasso image loading issue with Android 9.0 Pie

  12. 12

    Picasso loading of image spawned inside AsyncTask

  13. 13

    Picasso's image loading using fit() method

  14. 14

    Android,Picasso. Is not loading an Image from a url

  15. 15

    Picasso loading image error-Android

  16. 16

    Picasso image loading issue in GoogleMap.InfoWindowAdapter

  17. 17

    Picasso only loading one image in a BaseAdapter

  18. 18

    Picasso image loading issue with Android 9.0 Pie

  19. 19

    Picasso Image Loading Library, some issues

  20. 20

    Android: Lazy Loading Image in horizontalscrollview using Picasso

  21. 21

    Picasso loading image error-Android

  22. 22

    Android - Picasso removes margin after loading Image

  23. 23

    Picasso only loading single image but the size is 20

  24. 24

    Different width when loading same image with Picasso

  25. 25

    Picasso not loading image from a URL, sometimes

  26. 26

    Show an "Loading..." image while background loading of image with Picasso

  27. 27

    Show an "Loading..." image while background loading of image with Picasso

  28. 28

    Picasso image loader: loading updated images from url

  29. 29

    Synchronous image loading on a background thread with Picasso - without .get()

HotTag

Archive