0
我正在使用排球單身並添加所有排球請求。加入凌空請求的等待for循環中的多個排球響應
示例代碼排隊
MyApplication.getInstance().addToReqQueue(jsObjRequest, "jreq1");
我有一個onclick功能。
buttonId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for(int i=0;i<4;i++){
//....... here i call for asycn volley requests which get added to the queue of volleysingleton
}
// ******how to ensure all my volley requests are completed before i move to next step here.*****
//calling for new intent
Intent m = new Intent(PlaceActivity.this, Myplanshow.class);
m.putExtra("table_name", myplansLists.get(myplansLists.size() - 1).table_name);
m.putExtra("table_name_without_plan_number", myplansLists.get(myplansLists.size() - 1).place_url_name);
m.putExtra("changed", "no");
m.putExtra("plannumber", myplansLists.size());
//moving to new intent;
v.getContext().startActivity(m);
}
});
在onclick我有一個for循環,它將執行多個抽排請求。
for循環後,它會通過intent開始一個新的活動。
但是對於我的新活動來說,我需要for循環中的所有抽籤請求的數據在之前完成,它將離開此活動並轉到新活動。
我會嘗試,看起來應該工作。 –