Find and load cached Image in Glide

六眼飞鱼酱① 提交于 2019-12-12 10:47:11

问题


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?


回答1:


Use below code

Glide.with(mContext).load(ImageUrl).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);


来源:https://stackoverflow.com/questions/31066866/find-and-load-cached-image-in-glide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!