When the internet is slow, Glide takes too long time to show the image, I need to display the image immediately.
1) If your image is not changing rapidly you could use Glide disk and memory caching feature. Define the strategy using .diskCacheStrategy(DiskCacheStrategy) method. There are several DiskCacheStrategy you could use:
DiskCacheStrategy.NONE caches nothingDiskCacheStrategy.SOURCE caches only the original full-resolution image.DiskCacheStrategy.RESULT caches only the final image, after reducing the resolutionDiskCacheStrategy.ALL caches all versions of the image. This is the default behavior2) If your image changes rapidly you'll need to maybe load the cached image right away and then do the network call to fetch the update and load it if success. There are ways to do this but maybe you wanna look at RxJava and .concat
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With