Skip to content
Advertisement

Firestore – RecycleView – Image holder

I don’t know how to write a holder for an image. I already have 2 texts set, but I don’t know what the holder for the image should look like. Can you help me tell what the writeup for the image should look like in order for it to appear correctly?

JavaScript

My code:

JavaScript

Advertisement

Answer

You can use a library like Glide or Picasso to load the image from a given URL. Both libraries have lots of extra options for things like making the image round, adding a placeholder image while it loads, or adding an error image to show if it can’t load.

With Glide:

You can pass in a context to the adapter constructor, or get it from the holder root view to use with Glide

JavaScript

With Picasso:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement