Thursday 30 June 2016

RestAdapter updated to Retrofit in new version of Retrofit v2 API

The RestAdapter class was renamed to Retrofit and the API was completely remade. After the API was completely remade its not only the RestAdapter class changed to the Retrofit class but method like setEndPoint() and many more method has also been changed.
Eg : when we have the dependencies as compile 'com.squareup.retrofit:retrofit:1.9.0', then we use : RestAdapter restAdapter = new RestAdapter.Builder()
        .setEndpoint("http://www.json-generator.com/api/json/get")
        .build();
Later when new version of Retrofit came i.e. Revrofit v2.0 then we have to write this : 
Retrofit retrofit = new Retrofit.Builder().baseUrl("http://www.json-generator.com/api/json/get").build();

As of now we have the latest version of Retrofit v2.1. To know any updates about latest release of
Retrofit API visit :- http://square.github.io/retrofit/

No comments:

Post a Comment