Am using Glide version 4.8.0
And for loading an image I do this
GlideApp
.with(HomePageFragment.this)
.load(remoteURL)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(mImageView);
When the device is connected to Internet the image loades successfully but when device goes offline, how to load the same image from cache that was already featched from the remoteURL
?
My CustomAppGlideModule looks like this
@GlideModule
public class CustomAppGlideModule extends AppGlideModule {
@Override
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
builder.setMemoryCache(new LruResourceCache(20 * 1024 * 1024));
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, 100 * 1024 * 1024));
}
}
I also tried
.onlyRetrieveFromCache(true)
But that also does not help.