Skip to content

Instantly share code, notes, and snippets.

@prakashpun
Created December 24, 2017 16:23
Show Gist options
  • Save prakashpun/457364c454457cd3cb54b59c696cb18e to your computer and use it in GitHub Desktop.
Save prakashpun/457364c454457cd3cb54b59c696cb18e to your computer and use it in GitHub Desktop.
RetrofitClientInstance.java
public class RetrofitClientInstance {
private static Retrofit retrofit;
private static final String BASE_URL = "https://jsonplaceholder.typicode.com";
public static Retrofit getRetrofitInstance() {
if (retrofit == null) {
retrofit = new retrofit2.Retrofit.Builder()
.baseUrl(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