is there a method to add custom header to request when image is downloaded? I can use volley or okhttp in Glide.
I try add cookie to cookiemanager in okhttpclient, but i
Try this:
ImageView imgThumb = itemView.findViewById(R.id.image_thumb);
GlideUrl url = new GlideUrl("https://your-url.com", new LazyHeaders.Builder()
.addHeader("User-Agent", "your-user-agent")
.build());
RequestOptions options = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.NONE);
Glide.with(mContext).load(glideUrl)
.transition(withCrossFade())
.thumbnail(0.5f)
.apply(options)
.into(imgThumb);
The Glide reference is:
implementation 'com.github.bumptech.glide:glide:4.6.1'