Make Volley request in different thread

前端 未结 1 660
长情又很酷
长情又很酷 2020-12-31 04:18

I would like to make a request using the Android Volley library in a different thread.

What I mean is, there is the connection which is in the thread and the data is

相关标签:
1条回答
  • 2020-12-31 05:10

    Every network request performed by Volley is performed in a background thread. Volley takes care of this behind the scenes. So there is no need to perform a request on a different thread, since that's already happening.

    The listeners, on the other hand, are called on the UI thread.

    You basically answered your own question when you wrote that the data is processed on the UI thread. Simply move that data processing that is performed inside your listeners to a background thread / AsyncTask to free your UI thread and prevent the blocking.

    0 讨论(0)
提交回复
热议问题