1

I am using Picasso to inflate image from URL to Imageview:


@Override
    public void onBindViewHolder(@NonNull HeroesViewHolder holder, int position) {

        Hero currentHero = heroList.get(position);
        String str = String.join(",", currentHero.abilities);

        holder.heroTitle.setText(currentHero.title);
        holder.heroAbilities.setText(str);
        Picasso.get().load(currentHero.image).resize(500, 500).into(holder.heroesImage);

    }

The thing is that everything that is HTTP protocol won't show up at emulator & physical device, only the ones that are HTTPS. Instead of showing it, it just leaves a black space.

The images that are HTTP protocol are also .png extension, if that has anything to do with that.

how can I workaround this issue?

Alon Shlider
  • 1,187
  • 1
  • 16
  • 46

2 Answers2

1

Please try below code :

Picasso.with(this)  // Activity context
       .load(currentHero.image) // Set URL
       .resize(100,100) // Resize the image
       .placeholder(getResources().getDrawable(R.drawable.ic_defuser)) // Default Image
       .error(getResources().getDrawable(R.drawable.ic_defuser))
       .into(holder.heroesImage); // Imageview
Sagar Vekariya
  • 212
  • 1
  • 2
  • 6
0

Try this

Picasso.with(getApplicationContext())
     .load(img_url)
     .resize(5,5)
     .fit().centerCrop().into(methodImage);
Navin Kumar
  • 3,393
  • 3
  • 21
  • 46