Loading images from a remote URL
We just learned how to extract data from an API response. That data often includes URLs to images we want to present to the user. There is quite a bit of work involved in achieving that. First, you must fetch the image as a binary stream from the URL. Then, you need to transform that binary stream into an image (it could be a GIF, JPEG, or one of a few other image formats).
Then, you need to convert it into a bitmap instance, potentially resizing it to use less memory. You may also want to apply other transformations to it at that point. Then, you need to set it to a composable.
Sounds like a lot of work, doesn’t it? Well, luckily for us, there are a few libraries that do all of that (and more) for us. The most commonly used library is Glide by Bump Technologies (https://packt.link/sPJNB). Facebook’s Fresco (https://frescolib.org/) is somewhat less popular. A library that’s gained traction recently is Coil (https://coil...