I think Ficus Kirkpatrick said somewhere in his presentation on Volley that optimally, there is only one RequestQueue
.
If most of your activities, services and receivers make use of Volley, and you do a lot of switching between them, it makes sense to define a singleton RequestQueue
in your Application
object so that you don't have to instantiate a new RequestQueue
in every acticity / service / receiver onCreate
.
However, if you have a lot of activities, and use Volley in only one of them for one request, then you might be better off defining the RequestQueue
in just that Activity
, or it'll get instantiated in the activities in which you don't use it. This shouldn't hurt functionality, but could hurt memory-wise.
EDIT:
In the volley user group, Ficus said:
RequestQueues are pretty cheap (mostly just threads). We use more than one in our app in order to segregate caches.
Which tells us that it's also a valid use case to use multiple RequestQueues
if you need to have separate caches.