Preload multiple images with Glide

Use the following code to cache images without displaying them

  1. using the downloadOnly method if you are looking to download images from the web and store them in the diskCache:

    FutureTarget<File> future = Glide.with(applicationContext)
        .load(yourUrl)
        .downloadOnly(500, 500);
    
  2. using preload method if you want to load them into the Memory Cache.

    Glide.with(context)
            .load(url)
            .preload(500, 500);
    

You can later use the cached images using

Glide.with(yourFragment)
    .load(yourUrl)
    .into(yourView);

Leave a Comment