Posts

Showing posts from August, 2017

Retrofit Android Example Tutorial

Image
Welcome to Retrofit Android Example Tutorial. Today we’ll use the  Retrofit  library developed by Square to handle REST API calls in our android application. http://www.journaldev.com/13639/retrofit-android-example-tutorial Retrofit Android Retrofit is type-safe REST client for Android and Java which aims to make it easier to consume RESTful web services. We’ll not go into the details of Retrofit 1.x versions and jump onto  Retrofit 2  directly which has a lot of new features and a changed internal API compared to the previous versions. Retrofit 2 by default leverages  OkHttp  as the networking layer and is built on top of it. Retrofit automatically serialises the JSON response using a POJO(Plain Old Java Object) which must be defined in advanced for the JSON Structure. To serialise JSON we need a converter to convert it into  Gson  first. We need to add the following dependencies in our  build.grade  file. compile 'com.squareup.retrofit2:retrofit:2.1.0' c