-
Notifications
You must be signed in to change notification settings - Fork 15
Usage
TwistedEquations edited this page Jan 27, 2014
·
3 revisions
- Have your application class extend the TwistVolleyApplication
public class MyApplication extends TwistVolleyApplication {
@Override
public void onCreate() {
//Your on code here
super.onCreate();
}
}
-
Get the RequestQueue using the TwistVolley Helper method
RequestQueue requestQueue = TwistVolley.getRequestQueueFromApplication(this); -
Done! Now you can send any Volley request through the queue as before.
-
Get a reference to the TwistImageLoader from the TwistVolleyApplication
TwistImageLoader imageLoader = TwistVolley.getTwistImageLoaderFromApplication(this); -
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.