Skip to content

Instantly share code, notes, and snippets.

@brendoncheung
Created May 11, 2018 17:56
Show Gist options
  • Save brendoncheung/7859789f06e4df4382c49decdfa6a026 to your computer and use it in GitHub Desktop.
Save brendoncheung/7859789f06e4df4382c49decdfa6a026 to your computer and use it in GitHub Desktop.
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient {
private static Retrofit retrofit = null;
public static Retrofit getClient(String baseUrl) {
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment