Image Loading

Learn and practice how to load images from the internet in this lesson.

Dependencies

Loading an image from the Internet may sound like a trivial task, but it is not. There are a lot of cases which we would have to handle, some of them include the following:

  • Storing and retrieving the image from the RAM cache
  • Storing and retrieving the image from the disk cache
  • Scaling and resizing the image
  • Displaying the loading state and the error state
  • Handling out-of-memory scenarios
  • Handling concurrent image loading
  • Etc.

To avoid handling all the scenarios described above, there are several popular image loader libraries developed and distributed as open source. The most popular are:

In this lesson, we are going to use the Glide image loader. Let’s add the new library dependencies to the app/build.gradle file in the dependencies section.

Get hands-on with 1200+ tech skills courses.