0

I load some images only from cache, but I noticed, that images are not loaded in parallel, but first one and shortly after that second.

    Glide.with(getContext())
            .load(url)
            .onlyRetrieveFromCache(true)
            .into(imageView);

Seems that Glide load images from queue, one by one, not in parallel. How to change this?

Michalsx
  • 3,446
  • 5
  • 33
  • 46
  • Use Listener for loading the images. – Aniruddh Parihar Nov 20 '20 at 14:55
  • Does this answer your question? [Glide - how to load multiple images in parallel?](https://stackoverflow.com/questions/45012504/glide-how-to-load-multiple-images-in-parallel) – Farid Nov 20 '20 at 17:00
  • @Farid No, because it has nothing to do with network... – Michalsx Nov 20 '20 at 20:11
  • @Michalsx How did you conclude that cached images are loaded one-by-one?! This may help to find an answer. Also, there could be other reasons to make such impression; e.g. small pictures loaded first. – Farid Nov 21 '20 at 08:59

1 Answers1

0

Try to set multithreaded disk executor (setDiskCacheExecutor). Check https://bumptech.github.io/glide/doc/configuration.html for details

Anton Potapov
  • 1,265
  • 8
  • 11
  • I checked docs and I didn´t find way to do it. This is why I asked here. Redirecting to documentation is not the answer. – Michalsx Nov 20 '20 at 20:14
  • `@GlideModule public class YourAppGlideModule extends AppGlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { final UncaughtThrowableStrategy myUncaughtThrowableStrategy = new ... builder.setDiskCacheExecutor(newDiskCacheExecutor(myUncaughtThrowableStrategy)); builder.setResizeExecutor(newSourceExecutor(myUncaughtThrowableStrategy)); } }` – Anton Potapov Nov 21 '20 at 09:30
  • I do not understand, how I can set number of parallel work with code above. There is no number. Could you clarify this? – Michalsx Nov 25 '20 at 08:24