Loading Images from a Remote URL
We just learned how to extract particular data from an API response. Quite often, that data will include URLs to images we want to present to the user. There is quite a bit of work involved in achieving that. First, you have to 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 an ImageView
. 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 libraries are Square's Picasso (https://square.github.io/picasso/) and Glide by Bump Technologies (https://github.com/bumptech/glide). Facebook's Fresco (https://frescolib.org/) is somewhat...