Optimizing Volley

前端 未结 3 562
温柔的废话
温柔的废话 2021-02-09 06:05

I am using Volley library in android.I run the same url in the browser and it returns in less than a second.I would like to know , how can optimize Volley? Not clear on what is

3条回答
  •  再見小時候
    2021-02-09 06:53

    I had a similar kind of situation. I didn't notice the time delays as you did, but it was showing up in the browser and not in my app. Essentially, clearing the cache helped me out.

    You can clear the cache by:

    Requestqueue.getcache().clear();
    

    If you want to disable the caching for jsonrequests, you can do that by:

    jsonrequest.setshouldcache(false)
    

    This had solved my problem of the caching.

提交回复
热议问题