Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Android Volley Help
import android.content.Context;
public class RequestQueueSingleton {
private static RequestQueueSingleton requestQueueSingleton;
private RequestQueue requestQueue;
private static Context context;
private RequestQueueSingleton(Context ctx){
context = ctx;
requestQueue = getRequestQueue();
public static synchronized RequestQueueSingleton getInstance(Context context){
if (requestQueueSingleton == null){
requestQueueSingleton = new RequestQueueSingleton(context);
return requestQueueSingleton;
public RequestQueue getRequestQueue() {
if (requestQueue == null){
requestQueue = Volley.newRequestQueue(context.getApplicationContext());
return requestQueue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment