Android - cancel Volley request

后端 未结 4 1617
借酒劲吻你
借酒劲吻你 2020-12-06 16:53

I am using Android Volley lib in my project to execute network requests, all works very well but I have some troubles with the \"cancel\" feature of this lib. I explain my i

4条回答
  •  独厮守ぢ
    2020-12-06 17:21

    I'd suggest you to cancel the added requests in onPause() method. Considering:

    onPause() The system calls this method as the first indication that the user is leaving your activity (though it does not always mean the activity is being destroyed). This is usually where you should commit any changes that should be persisted beyond the current user session (because the user might not come back). source: Android Developers

提交回复
热议问题