如何使用Volley网络请求队列? [英] How do I use the Volley network request queue?
问题描述
我.add(
对我的Volley Request Queue进行了新的网络调用,我根据建议将其创建为单例.但是我总是立即.start()
这些网络呼叫.始终将其作为活动或片段中的动作来完成.
I .add(
new network calls to my Volley Request Queue which I have created as a singleton as suggested. But I always immediately .start()
these network calls. This is always done as an action in an activity or a fragment.
add
方法甚至不能像.add(new volley request).start()
因此,这是假定我实际上在Volley处理其队列的方式之外实际上正在某个地方管理(或想要管理)网络队列.我是否应该将这些东西发送到IntentService并侦听IntentService将响应发送回我的Fragment/Activity?
So this assumes I am actually managing (or wanting to manage) a network queue somewhere, outside of the way Volley handles its queue, I guess. Should I be sending these things to an IntentService and listening for the IntentService to send a response back to my Fragment/Activity?
推荐答案
作为排球用户,我可以告诉你我从未调用过.start()方法.我添加到队列中的所有请求都会自动开始,我像您一样使用了singleton类.
As a volley user I can tell you that I have never called .start() method. all the requests i've added to the queue started automatically, I used singleton class like you did.
这篇关于如何使用Volley网络请求队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!