1

I'm using Glide in my library and trying to increase the timeout

I found this question but using AppGlideModule in the library is discouraged

and LibraryGlideModule doesn't generate any api and is not intended to be consumed by the library itself.

I want a way to set the timeout without using the generated api.

Zoe
  • 27,060
  • 21
  • 118
  • 148
humazed
  • 74,687
  • 32
  • 99
  • 138

2 Answers2

4

You can use RequestOptions.timeoutOf(5000) which will change the timeout from the default 2500ms

it's also an easy way if you don't want to use the generated api just for the timeout.

full example:

Glide.with(context)
            .load(url)
            .apply(RequestOptions.timeoutOf(5 * 60 * 1000))
            .into(imageView)
humazed
  • 74,687
  • 32
  • 99
  • 138
1

You can use this method of glide

.timeout(60000)

the final code sample will be:

Glide.with(imageView.getContext())
            .load(finalUrl)
            .timeout(60000)
            .placeholder(R.drawable.place_holder)
            .into(imageView);
Mahdi Zareei
  • 1,299
  • 11
  • 18