Exploring Retrofit as an HTTP networking client for Android
For the application to obtain data from our database, we need to implement an HTTP client that will send network requests to the REST API of the database.
Instead of working with the HTTP library provided by default by Android, we will use the Retrofit HTTP client library, which lets you create an HTTP client that is very easy to work with.
If you plan to develop an HTTP client that interfaces with a REST API, you will have to take care of a lot of things – from making connections, retrying failed requests, or caching to response parsing and error handling. Retrofit saves you development time and potential headaches as it abstracts most of the underlying complexity associated with handling network requests and responses.
In this section, we will cover the following topics:
- Using Retrofit
- Adding Retrofit to the Restaurants application
- Mapping JSON to model classes
- Executing GET requests...