Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android Volley Help
package com.syntech.spurno.post;
import android.content.Context;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
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