Search code examples
androidandroid-imageviewpicasso

Picasso setting placeholder image but not the actual image


I am using the Picasso library on android to display profile images, but the image does not load for some reason and the app only displays the placeholder image.

Picasso.get()
            .load(R.drawable.ic_person_black_100dp)
            .placeholder(R.drawable.common_full_open_on_phone)
            .into(profileImageView);

Solution

  • Picasso 2.X doesn't support vector drawable. You can either use Glide or use a workaround:

    Glide.with(context)
       .load(R.drawable.my_vector_drawable)
       .into(mImageView);
    

    When load() call fails, the error handling mechanism of Picasso seems to work with vector drawables:

    Picasso.get()
        .load(R.drawable.my_vector_drawable)
        .error(R.drawable.my_vector_drawable)
        .into(mImageView);