Summary
In this chapter, we learned how to fetch data from an API using Retrofit. We then learned how to handle JSON responses, as well as plain text responses, using Moshi. We also saw how different error scenarios could be handled.
We later learned how to load images from URLs using Glide and how to present them to the user via ImageView
.
There are quite a few popular libraries for fetching data from APIs and for loading images. We only covered some of the most popular ones. You might want to try out some of the other libraries to find out which ones fit your purposes best.
In the next chapter, we will be introduced to RecyclerView
, which is a powerful UI component that we can use to present our users with lists of items.