I have an app that loads images on each item on a list view, and I use Volley to make life easier for me; I need to have to images loaded from disk if it's already been downloaded before.
<strong>Problem:</strong> It won't work. It needs to re-download the images all over again. I need to have the image saved even after I exit the app.
<strong>Weird:</strong> It works only on one particular image (and it has nothing to do with size)!
<strong>What I Used:</strong> I patterned this using this site: <a href="https://github.com/rdrobinson3/VolleyImageCacheExample" rel="nofollow">https://github.com/rdrobinson3/VolleyImageCacheExample</a>.
I also tried this: <a href="http://howrobotswork.wordpress.com/...-a-bitmap-asynchronously-with-volley-example/" rel="nofollow">http://howrobotswork.wordpress.com/...-a-bitmap-asynchronously-with-volley-example/</a>
<strong>The Code:</strong>
I've tried the meme website, and it still has problems. I had one particular site that contains an image that oddly works. Which makes it even more confusing.
<strong>Edit:</strong> Additional info, it seems like there's an error on adding lruEntries as lruEntries.remove(entry.key is being called on completeEdit().
<strong>Problem:</strong> It won't work. It needs to re-download the images all over again. I need to have the image saved even after I exit the app.
<strong>Weird:</strong> It works only on one particular image (and it has nothing to do with size)!
<strong>What I Used:</strong> I patterned this using this site: <a href="https://github.com/rdrobinson3/VolleyImageCacheExample" rel="nofollow">https://github.com/rdrobinson3/VolleyImageCacheExample</a>.
I also tried this: <a href="http://howrobotswork.wordpress.com/...-a-bitmap-asynchronously-with-volley-example/" rel="nofollow">http://howrobotswork.wordpress.com/...-a-bitmap-asynchronously-with-volley-example/</a>
<strong>The Code:</strong>
Code:
String godzilla = "http://vineland.pynchonwiki.com/wiki/images/c/cf/Godzilla.jpg";
//String meme = "http://upload.wikimedia.org/wikipedia/en/d/d7/Meme_Many_Journeys.jpg";
ImageCacheManager.getInstance().getImageLoader().get(godzilla, new ImageLoader.ImageListener() {
@Override
public void onResponse(ImageLoader.ImageContainer imageContainer, boolean b) {
viewHolder.backgroundImage = imageContainer.getBitmap();
updateBackgroundImage(viewHolder, viewHolder.backgroundImage, object);
updateLayoutAlignmentParams(viewHolder);
}
@Override
public void onErrorResponse(VolleyError volleyError) {
}
});
if(viewHolder.backgroundImage != null)
updateBackgroundImage(viewHolder, viewHolder.backgroundImage, object);
I've tried the meme website, and it still has problems. I had one particular site that contains an image that oddly works. Which makes it even more confusing.
<strong>Edit:</strong> Additional info, it seems like there's an error on adding lruEntries as lruEntries.remove(entry.key is being called on completeEdit().