okhttp循環請求網絡

while (w <lisck.size()) {
    Log.d("---------",w+"===");
    if (pp) {

        pp = false;

        if (w<lisck.size())
        {


        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("sellerid", lisck.get(w).getSellerid() + "");
        map.put("pid", lisck.get(w).getPid() + "");
        map.put("num", lisck.get(w).getNum() + "");
        map.put("selected", lisck.get(w).getSelected() + "");
        map.put("token", token);

        OkHttp3Util.doPost("url", map, new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                pp = true;
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                Log.d("------",response.body().string());
                if (response.isSuccessful()) {

                    if (w == lisck.size()) {
                        pp = false;
                    } else {
                        pp = true;
                        w++;

                    }
                }
                else {
                    pp = true;
                }


            }
        });
        }
    }

}
    if (w >= lisck.size()) {


        pp=true;
        w=0;
        getDataNet();

    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章