Skip to content
Advertisement

Preload multiple images with Glide

We are trying to preload images into cache memory to load them later (the images are located in the Asset folder of the application)

What we tried:

JavaScript

The issue: Images are cached only when we are trying to load/display them: They have to be loaded in memory before so that they appear faster.

JavaScript

We also tried to use a GlideModule to increase the CacheMemory size:

JavaScript

In the manifest:

JavaScript

Nothing is working so far. Any idea?


We trying to use an invisible 1 dp imageView, but the result is the same:

JavaScript

Advertisement

Answer

The best option is to handle caching yourself, it gives you more control & should be easy as you already know what bitmaps are to be loaded.

First: Setup a LruCache

JavaScript

Second: Load the bitmaps to the LruCache

JavaScript

Third: Use the cached bitmaps

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement