Find and load cached Image in Glide
Asked Answered
I

1

7

I am new in glide and want to migrate my app from universalimageloader to glide. I want to convert cached image from the disk into image file, and show it into an ImageView.

When I use universalimageloader, I can do it easily with this way:

File imageFile = DiskCacheUtils.findInCache(image_url,  ImageLoader.getInstance().getDiscCache());
//then show it into image view
String file_target = "file://"+imageFile.getPath();
ImageLoader.getInstance().displayImage(target, imageView);

However I have not found a way from documentation to do that in Glide.

Is it possible?

Iyre answered 26/6, 2015 at 6:58 Comment(5)
Lets follow up on your issue on GitHub: github.com/bumptech/glide/issues/509Indigotin
We're also migrating from UniversalImageLoader and we found loss of funcionability. For example, loading an image from cache is done with a single line: ImageLoader.getInstance().getDiscCache().get(info.getDownload().getIcon()) and I have a Bitmap loaded from cache only (if doesn't exist, it doesn't download).Sundries
@HenriquedeSousa could you tell me, please, what was the reasons for this migration? And did you managed these shortcomings of Glide?Reparative
No, we ended up keeping the two image libraries, we had no time to investigate on this. SorrySundries
Yes, I had to keep UIL due that issue as well.Reparative
M
3

Use below code

Glide.with(mContext).load(ImageUrl).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);
Mixie answered 21/7, 2016 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.