Created
November 6, 2013 15:32
-
-
Save omarmiatello/7338054 to your computer and use it in GitHub Desktop.
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.neosperience.egea.utils.volleytoolbox; | |
import com.android.volley.RequestQueue; | |
import com.android.volley.toolbox.Volley; | |
import android.content.Context; | |
/** | |
* Manager for the queue | |
* | |
* @author Trey Robinson | |
* | |
*/ | |
public class RequestManager { | |
/** | |
* the queue :-) | |
*/ | |
private static RequestQueue mRequestQueue; | |
/** | |
* Nothing to see here. | |
*/ | |
private RequestManager() { | |
// no instances | |
} | |
/** | |
* @param context | |
* application context | |
*/ | |
public static void init(Context context) { | |
mRequestQueue = Volley.newRequestQueue(context); | |
} | |
/** | |
* @return | |
* instance of the queue | |
* @throws | |
* IllegalStatException if init has not yet been called | |
*/ | |
public static RequestQueue getRequestQueue() { | |
if (mRequestQueue != null) { | |
return mRequestQueue; | |
} else { | |
throw new IllegalStateException("Not initialized"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment