Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get cached bitmap from url? #54

Closed
DavidJoe opened this issue Dec 18, 2013 · 5 comments
Closed

How to get cached bitmap from url? #54

DavidJoe opened this issue Dec 18, 2013 · 5 comments
Labels

Comments

@DavidJoe
Copy link

How to get cached bitmap from url?

@sjudd
Copy link
Collaborator

sjudd commented Dec 18, 2013

The only way to guarantee that you will get a bitmap back is to use the original Glide.load call you used to download and display the bitmap originally.

@mwyszomierski
Copy link

sjudd, could you elaborate - I've got a bitmap loaded in one activity like:

Glide.load("foo.png").into(myImageView);

then I kill all my network connections, start a new activity, make a call with the same url:

Glide.load("foo.png").into(anotherImageView);

but this one fails to load anything. I was expecting the bitmap from the original request to be in the mem cache, or at least in a disk cache.

Using the 2.x release.

@sjudd
Copy link
Collaborator

sjudd commented May 28, 2014

Do both image views have the same dimensions? The dimensions returned by the Target (in this case ImageViewTarget: https://github.com/bumptech/glide/blob/master/library/src/com/bumptech/glide/presenter/target/ImageViewTarget.java) are included in the cache key.

If they do, as long as all the options specified in the Glide.load call are the same in both cases and the disk cache isn't full, what you describe should work.

@mwyszomierski
Copy link

Ok thanks got it, I used a simple target as shown in this ticket:

#55

to make sure I get a cache hit. I supply the exact width and height of the imageview from the first activity, then use the cache hit as needed with the second activity.

The library has been working great!

@sjudd
Copy link
Collaborator

sjudd commented Jun 28, 2014

Glad it's been working, thanks for the question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants