Config Glide library for caching

Tags: , ,



How to set glide in the android project so that once images download to the app each time then displayed by the glide cache

Glide.with(context).load(url).into(imageView);

Answer

Set your Glide object by providing the request options and that’s it. Glide will take care of caching for you. Happy coding with Glide “A simple and feature rich image loading library.”

val requestOptions = RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL)
Glide.with(context).load(url).apply(requestOptions).into(imageView)


Source: stackoverflow