Skip to content

Instantly share code, notes, and snippets.

@ovicko
Last active June 11, 2019 18:09
Show Gist options
  • Save ovicko/5b4d1da92ff03e55c6188375a1e33322 to your computer and use it in GitHub Desktop.
Save ovicko/5b4d1da92ff03e55c6188375a1e33322 to your computer and use it in GitHub Desktop.
RetrofitHelper
public class RetrofitHelper {
private Retrofit.Builder retrofit;
public RetrofitHelper() {
retrofit = new Retrofit.Builder()
.baseUrl(RetrofitApi.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(new OkHttpClient()
.newBuilder()
.addNetworkInterceptor(
new HttpLoggingInterceptor()
.setLevel(HttpLoggingInterceptor.Level.BODY)).build());
}
public <T> T getService(Class<T> tService) {
return retrofit.build().create(tService);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment