A common RequestQueue object for your Android app using Google Volley in the form of a Singleton.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A common RequestQueue object for your Android app using Google Volley in the form of a Singleton.

The singleton provides access to static RequestQueue and ImageLoader objects via its two methods:

    public RequestQueue getRequestQueue(){
        return this.mRequestQueue;
    public ImageLoader getImageLoader(){
        return this.mImageLoader;


##Import Google Volley Import the Google Volley Library into your Android project


##Add VolleySingleton.java Include the VolleySingleton.java class from this repository in your Android application.

##Update the singleton AppContext On line 15 of the VolleySingleton.java class, update the context to be fetched from your Application class.

There is a sample of what your Application class might look like in the MyApplication.java file.

mRequestQueue = Volley.newRequestQueue(MyApplication.getAppContext());

Also make sure that MyApplication is defined in your manifest

<application android:name="com.company.MyApplication">


##Use it in your code Import the Volley packages

    import com.android.volley.VolleyError;
    import com.android.volley.toolbox.ImageLoader;
    import com.android.volley.toolbox.NetworkImageView;

Instantiate an ImageLoader variable

    private ImageLoader mImageLoader;

Initialize the ImageLoader variable in your OnCreate() method

    public void onCreate(Bundle savedInstanceState) {

        mImageLoader = VolleySingleton.getInstance().getImageLoader();

Use it where appropriate

     NetworkImageView avatar = (NetworkImageView)view.findViewById(R.id.twitter_avatar);