Created
November 13, 2016 18:41
-
-
Save apvasanth03/c6a413acd26b04de3b244e47c458024b to your computer and use it in GitHub Desktop.
Android Http Client Abstraction - RestApiApplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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