Disable Volley cache management

If you use any of the default Request classes implemented in volley(e.g. StringRequest, JsonRequest, etc.), then call setShouldCache(false) right before adding the request object to the volley RequestQueue: request.setShouldCache(false); myQueue.add(request); If you have your own implementation of the Request class, then you can call setShouldCache(false) in the constructor of your class. This solution disables caching … Read more

Android Volley ImageLoader – BitmapLruCache parameter?

import android.graphics.Bitmap; import android.support.v4.util.LruCache; public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageCache { public static int getDefaultLruCacheSize() { final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int cacheSize = maxMemory / 8; return cacheSize; } public BitmapLruCache() { this(getDefaultLruCacheSize()); } public BitmapLruCache(int sizeInKiloBytes) { super(sizeInKiloBytes); } @Override protected int sizeOf(String key, Bitmap value) { … Read more

Glide – adding header to request

Since 3.6.0 it’s possible to set custom headers for each request: GlideUrl glideUrl = new GlideUrl(“url”, new LazyHeaders.Builder() .addHeader(“key1”, “value”) .addHeader(“key2”, new LazyHeaderFactory() { @Override public String buildHeader() { String expensiveAuthHeader = computeExpensiveAuthHeader(); return expensiveAuthHeader; } }) .build()); Glide….load(glideUrl)….;

Android set up Volley to use from cache

Please note that if the web service supports caching output, you don’t have to use CacheRequest below, because Volley will automatically cache. For your issue, I use some codes inside parseCacheHeaders (and refering to @oleksandr_yefremov‘s codes). The following code I have tested. Of course, can use for JsonArrayRequest also. Hope this help! JsonObjectRequest jsonObjectRequest = … Read more

tech