[英]Android LoopJ's HTTP client
我正在使用LoopJ將我的應用程序連接到Web服務。
我在for循環中使用AsyncHttpClient發出多個ws請求(我必須在一個循環中發送它們;我不能一次全部發送它們)
對於我認為的每一次回應,我都必須在我的應用程序中修改特定的TextView。 (我擁有相等數量的ws請求的textview的數量)
有沒有一種方法可以在我制作的每個新AsyncHttpClient()上綁定一些信息(字符串),並在onSuccess上檢索這些信息?
我認為您可以按照以下方式進行
int count=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
count++;
new Netcall().execute();
//call assync task for first timehere
}
private static class Netcall extends AsyncTask<String, String, String>{
@Override
protected String doInBackground(String... arg0) {
//your code http call
}
@Override
protected void onPostExecute(String result) {
count++;
if(count<=numberoftimesyouwanttoexecute)
new Netcall().execute();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.