Skip to content

Instantly share code, notes, and snippets.

@vincent-paing
Created September 25, 2016 06:23
Show Gist options
  • Save vincent-paing/3aa402c0389f2882255fd87330689b25 to your computer and use it in GitHub Desktop.
Save vincent-paing/3aa402c0389f2882255fd87330689b25 to your computer and use it in GitHub Desktop.
Rerofit Adapter Static Factory Method
public static Retrofit getRetrofit() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
return new Retrofit.Builder().baseUrl(BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment