Skip to content

Instantly share code, notes, and snippets.

@apvasanth03
Created November 13, 2016 18:41
Show Gist options
  • Save apvasanth03/c6a413acd26b04de3b244e47c458024b to your computer and use it in GitHub Desktop.
Save apvasanth03/c6a413acd26b04de3b244e47c458024b to your computer and use it in GitHub Desktop.
Android Http Client Abstraction - RestApiApplication
package com.vasanth.restapiapplication;
import android.app.Application;
import com.vasanth.restapiapplication.httprestapi.HttpClientApi;
import com.vasanth.restapiapplication.httprestapi.volley.VolleyHttpRestApiImpl;
/**
* Rest Api Application.
* <p>
* 1. Responsibility.
* 1.a. Application class.
*
* @author Vasanth
*/
public class RestApiApplication extends Application {
private HttpClientApi mHttpRestApi;
@Override
public void onCreate() {
super.onCreate();
initializeHttpClient();
}
/**
* Used to initialize HTTP Client.
*/
private void initializeHttpClient() {
mHttpRestApi = VolleyHttpRestApiImpl.getInstance(this);
}
/**
* Used to get HTTP client api to perform rest api calls.
*
* @return HTTP client api.
*/
public HttpClientApi getHttpClientApi() {
return mHttpRestApi;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment