title: Custom keys for Android Volley images
body: <p>When creating a Volley ImageLoader it requires a ImageCache object to be passed in as a parameter. The ImageCache is an interface,</p>
  
  <pre><code>public interface ImageCache {
      public Bitmap getBitmap(String url);
      public void putBitmap(String url, Bitmap bitmap);
  }
  </code></pre>
  
  <p>, and putBitmap will be called by Volley whenever it successfully downloads an image, and it will use the URL passed into the call to get everything going,</p>
  
  <pre><code>imageView.setImageUrl(url, imageLoader)
  </code></pre>
  
  <p>, and call putBitmap itself. This will associate the url as the key to get the bitmap from the ImageCache.</p>
  
  <p>My problem is that the URLs I am passing in have hashed time stamps for query parameters, thus I won't be able to use the raw URL as a key to get the bitmap later since the hashed timestamp will be different. </p>
  
  <p>I see that I have two options. Either truncate the timestamp to use the url, or find a way to use some other value for the key. </p>
  
  <p>I would ideally like to use a String value that is in a custom model which the url is in also, but I don't see any way to change the fact that the url is all I have to work with in the ImageCache, and I cannot easily fetch the model containing the id easily from the URL.</p>
  
  <p>Is truncating the URL my best option?</p>
  
  <p>tl;dr Can I use something other than the URL for a key with a Volley ImageCache?</p>