Posts

Showing posts from May, 2016

Retrofit in Android

Image
Type-safe HTTP client for Android and Java by Square, Inc.
Retrofit is a REST Client for Android and Java bySquare. This library is easy learn and has more features. This is beginner friendly compared to other Networking libraries. You can GET,POST,PUT,DELETE  ..etc using this library. You can also use picasso for image loading.
3 classesIn Retrofit,we need to create 3 classes.
POJO (Plain Old Java Object) or Model Class :– The json retrieved from the server is added to this class. Interface :- Now we need to create an interface for managing url calls like GET,POST..etc.This is the service class. RestAdapter Class :- This is RestClient Class. Gson is used in default for the retrofit.You can use setup your own converter
Adding Retrofit Library to Project Gradle    : compile 'com.squareup.retrofit2:retrofit:2.0.2'      MAVEN <dependency>