Skip to content

Instantly share code, notes, and snippets.

@omarmiatello
Created November 6, 2013 15:32
Show Gist options
  • Save omarmiatello/7338054 to your computer and use it in GitHub Desktop.
Save omarmiatello/7338054 to your computer and use it in GitHub Desktop.
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