Retrofit Tutorial Part 1 - SIMPLE GET REQUEST - Android Studio Tutorial

In this video series we will learn how to use Retrofit, which is a type-safe HTTP client for Android and Java. Retrofit allows easy communication with a web service by abstracting the HTTP API into a Java interface. In part 1 we will set up Retrofit in a new Android Studio project by adding the necessary Gradle dependencies, and then already do our first GET request. We create an interface with 1 method that we annotate with @GET and the relative URL to the API endpoint of the REST API we want to query. We then create a Retrofit instance, define the baseUrl, add GSON as the converter by passing GsonConverterFactory to the addConverterFactory method, and let Retrofit create the implementation of our API interface at compile time. The Call object that our GET method returns encapsulates a single request response. With enqueue we can execute this request asynchcronously on a background thread and get our result back in the onResponse callback. OnFailure will be called if something in the proc
Back to Top