REST Calls using Retrofit
Retrofit is a HTTP client for Android and Java, it turns your HTTP API into a Java interface. This time I will show you how to create a basic project using Retrofit.
Setup Create a new project in android studio with no Activity, default options and set the following dependencies in build.gradle.kts
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion") Here we are using Gson converter to transform the JSON responses to the model classes.
In this example we are going to use a Fruitypedia API to get smoothie categories: https://fruitypedia.
[Read More]