如何使用Volley库Android执行简单的异步任务
您知道Google宣布了一个新的Volley库来管理基于HTTP协议的网络请求.
As you know Google has announced a new library Volley to manage network request based on HTTP Protocol.
但是如果我想使用该库连接到msql db.目前,我正在使用异步任务进行网络通话.
But if i want to use this library to connect to msql db . Currently i am using async task to do my network calls .
如何实现凌空库做异步任务?任何链接或示例.对不起,英语不好:)
How to implement volley library to do async task ? any links or example . sorry for bad english :)
Volley自行启动后台线程,因此所有网络请求均在UI线程之外执行,因此基本上您不再需要使用AsyncTask .当然,在轮换或用户退出活动时,您必须小心取消正在运行的请求.
Volley is starting background thread(s) on its own so all the network requests are executed off the UI thread so basically you don't need to use AsyncTask anymore. Of course you will have to take care to cancel the running requests on rotation or when user exits your activity.