Skip to content

Instantly share code, notes, and snippets.

@bolhoso
Created January 13, 2014 19:10
Show Gist options
  • Save bolhoso/8406165 to your computer and use it in GitHub Desktop.
Save bolhoso/8406165 to your computer and use it in GitHub Desktop.
package com.myapp;
import android.app.Application;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class MyApplication extends Application {
private static RequestQueue requestQueue;
private static MyApplication appInstance = null;
public static MyApplication getInstance() {
return appInstance;
}
public MyApplication() {
super();
appInstance = this;
}
public static synchronized RequestQueue getNetworkRequestQueue () {
if (MyApplication.requestQueue == null) {
MyApplication.requestQueue = Volley.newRequestQueue(appInstance);
}
return MyApplication.requestQueue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment