Android Volley Returning results twice for one request

前端 未结 3 505
傲寒
傲寒 2021-01-04 23:38

I have been trying to figure out this issue for two days now and I am completly stumped. For some reason I am sending one request to the queue but volley is returning it tw

3条回答
  •  盖世英雄少女心
    2021-01-04 23:50

    To stop the multiple request you can configure retry policy for your request object by using the setRetryPolicy() method of the request object. I managed to do this with following code:

    req.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 0,
          DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
    

    With the above code, i reduced the timeout to 2 seconds and set the number of retries to 0.

提交回复
热议问题