Retrofit is a type-safe REST client for Android developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp. See this guide to understand how OkHttp works.
This library makes downloading JSON or XML data from a web API fairly straightforward. Once the data is downloaded then it is parsed into a Plain Old Java Object (POJO) which must be defined for each "resource" in the response.
Setup
Dependencies
Add following dependencies on app/build.gradle file:
Converter:
Here is the different type of Gson converter, we can use them:
How to create retrofit instance,
then we have to define, the userendpoint:Download Full code: https://github.com/dharmakshetri/Android-API-Demos
and you can find out Awesome Retrofit Article: Retrofit Tutorial With Example In Android Studio [Step by Step]
More details:
https://square.github.io/retrofit/https://github.com/square/retrofit
https://guides.codepath.com/android/Consuming-APIs-with-Retrofit
https://realm.io/news/droidcon-jake-wharton-simple-http-retrofit-2/
http://www.vogella.com/tutorials/Retrofit/article.html
Happy Coding !!!