Skip to content

Instantly share code, notes, and snippets.

@dharmakshetri
Created December 29, 2016 08:19
Show Gist options
  • Save dharmakshetri/ac669bb0ea6e39a61f9fb7d0cc2c9996 to your computer and use it in GitHub Desktop.
Save dharmakshetri/ac669bb0ea6e39a61f9fb7d0cc2c9996 to your computer and use it in GitHub Desktop.
package co.apidemos.rest;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by dharma kshetri on 12/27/16.
*/
public class APIClient {
public static final String STACKOVERFLOW_BASE_URL="https://api.stackexchange.com" ;
public static Retrofit retrofit=null;
// get stackoverflow client
public static Retrofit getStackOverFLowClient(){
if(retrofit == null){
retrofit=new Retrofit.Builder()
.baseUrl(STACKOVERFLOW_BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment