2015-04-16 146 views
0

我正在使用LoopJ将我的应用程序连接到Web服务。Android LoopJ的HTTP客户端

我使多个WS请求在使用AsyncHttpClient for循环(I必须在一个环路发送它们;我不能在一个发送他们全部)

对于每个我recive我必须修改特定的TextView在resond我的应用程序(我有相同数量的Ws请求的textview的数量)

有没有办法在每个新的AsyncHttpClient()上绑定一些信息(字符串),并检索onSuccess上的这些信息?

+0

你说的绑定信息的意思去了? – dhams

+0

一些如何添加/存储到该ws请求编辑文本的id,我需要在onSuccess被调用时更改信息。例如:我可以有5个edittext。我做了一个for循环(5次迭代),生成5个单独的ws请求。我需要onSuccess被调用来知道我需要修改的edittext。我无法发送id作为参数,因为ws不在我的控制范围之内。 – Huliganul

+0

您可以将ID传递给每个网络服务电话,这会给您带回相同的ID作为回应 – dhams

回答

0

我想你可以通过以下方式

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(); 
} 

}