I want to use Volley's NetworkImageView
to load images from my REST API that needs Basic HTTP Authorization. So i need to add headers to HTTP Request.
I've made up following approaches:
Override Request.getHeaders()
- as described in this question.
This would be fine, but the problem is that ImageLoader
has new ImageRequest()
hardcoded so I can't pass my Request
implementation into ImageLoader
and it cannot be easily inherited and tweaked (the method i'd need to reimplement uses private properties).
The solution is to modify Volley library itself (what i'd like to avoid).
Use Custom HttpClientStack - as described here. Using this approach i'd be able to intercept HTTP comunication and add necessary headers. But I think this is not the right way to do - I'd loose automatic selection of HttpClient by Volley (Gingerbread vs. HC and IC).
Is there some simplier way to achive this that I'm missing?