Skip to content
TwistedEquations edited this page Jan 27, 2014 · 3 revisions

Basic Usage (RequestQueue)

  1. Have your application class extend the TwistVolleyApplication
public class MyApplication extends TwistVolleyApplication {

       @Override
       public void onCreate() {
           //Your on code here
           super.onCreate();
       }
}
  1. Get the RequestQueue using the TwistVolley Helper method RequestQueue requestQueue = TwistVolley.getRequestQueueFromApplication(this);

  2. Done! Now you can send any Volley request through the queue as before.

TwistImageLoader

  1. Get a reference to the TwistImageLoader from the TwistVolleyApplication TwistImageLoader imageLoader = TwistVolley.getTwistImageLoaderFromApplication(this);

  2. Load an image using the get method

imageLoader.get("http://i.imgur.com/CKsV3ic.jpg",500,500,new TwistImageLoader.ImageLoadListener() {
            @Override
            public void onImageLoad(TwistImageContainer container, boolean success, boolean fromCache) {
                //Image is returned in the TwistImageContainer with the 
                // dimensions, url and id passed in the get method 
            }
        },0);

Images are cached on the disk in their raw byte format and also a scaled copy is cached in memeory. To change the location/size of the cache override the methods in TwistVolleyApplication. The memory cache size can be changed as well. By default it is 1/8 of the apps memory.

Clone this wiki locally