Summary
In this chapter, we learned how to fetch data from an API using Retrofit. We then learned how to handle JSON responses using Moshi, as well as plain text responses. We also saw how different error scenarios can 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 as well as 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 purpose 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.