Cancel All Volley Requests Android

前端 未结 9 1299
我在风中等你
我在风中等你 2020-12-05 14:23

At the moment i´m using mRequestQueue.cancelAll(getActivity()) at on stop method in a fragment but apparently when i move the phone from landscape to portrait it is still re

9条回答
  •  粉色の甜心
    2020-12-05 14:56

    In Case Of Fragment; Use only One RequestQueue rQueue; Initialize it in OnCreate method; And use it for all volley request; and at the end

    @Override

    public void onStop () {
    
        super.onStop();
        if (rQueue != null) {
            rQueue.cancelAll(this);
        }
    }
    

提交回复
热议问题