Volleyball depends on your cache implementation for successful effective caching. The constructor for ImageLoader is ImageCache , which is Volleyβs simple interface for saving and loading bitmap images.
public ImageLoader(RequestQueue queue, ImageCache imageCache)
Quote from the Javadoc ImageCache interface:
Simple cache adapter interface. If provided by ImageLoader, it will be used as the L1 cache before being sent to Volley. Implementations should not be blocked. It is recommended to use LruCache.
Darwind is right. If you request an image and it is present in the cache, it will be downloaded from the cache, not from the Internet. This should be for you, since you are uploading and presenting an image that, when clicked, should appear in the cache in your new action.
You say that this does not work, perhaps your implementation is not optimized for your use. What type of cache are you using? Do you have one centralized RequestQueue and ImageLoader , as recommended by the Volley team?
Take a look at this question , which is not exactly the same as yours, but may be useful to you. It has a simple LRU cache implementation.
Hope this helps!
Edit:
The volleyball point is not worried about implementation details. Do you want an image? he will download it for you in the best and fastest way (from memory, and if not online). That is how you should look at it. Fetching the cache and then looking in it for the wrong IMO approach.
Now, if you want to manipulate a bitmap image, you have several options, the best IMO for implementing your own Image Listener pass it to the get() method instead of the standard one.
Something like that:
public class MyImageListener implements ImageListener() { @Override public void onErrorResponse(VolleyError error) {
from Javadoc:
Call flow:
After joining the request, onResponse (response, true) will be called to reflect any cached data that was already available. If data was available, response.getBitmap () will not be null.
After the network response is answered, only one of the following cases will occur:
onResponse (response, false) will be called if the image has been uploaded.
or
onErrorResponse will be called if there was an error loading the image.