Created
October 31, 2018 11:58
-
-
Save SPurno/b790e293e1eaa8e8fbefc62964884a07 to your computer and use it in GitHub Desktop.
Android Volley Help
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.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