

2. Declaring DependenciesĪfter creating a new project, declare the following dependencies in your adle.

We'll be using the API provided by JSONPlaceholder-this is a fake online REST API for testing and prototyping.Ĭheck out my previous post, Get Started With Retrofit 2 HTTP Client, to learn how to execute GET requests and how to integrate Retrofit with RxJava.įire up Android Studio and create a new project with an empty activity called MainActivity. I'll also show you how to integrate with RxJava and how to cancel requests. In this tutorial, I will explain how to use Retrofit 2 to handle network requests by building a simple app that will perform POST requests, PUT requests (to update entities), and DELETE requests.

Retrofit, on the other hand, is a well-planned, documented and tested library that will save you a lot of precious time and headaches.

In this tutorial, I'll show you how to use one of the most popular and often recommended HTTP libraries available for Android. Retrofit makes it easy to connect to a REST web service by translating the API into Java interfaces. Retrofit is a type-safe HTTP client for Android and Java.
