How to do a simple async task using volley library

2020-07-08 06:58发布

问题:

As you know Google has announced a new library Volley to manage network request based on HTTP Protocol.

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 :)

回答1:

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.