0

I'm using LoopJ to connect my app to a web service.

I make multiple ws request using AsyncHttpClient in a for loop ( i must send them in a loop ; i can not send them all at one )

For each resond that i recive i must modify a specific TextView in my app. ( the number of textview's that i have equal number of ws requests)

Is there a way to bind some information (string) on each and every new AsyncHttpClient() that i make and retrive this information on onSuccess?

Stephane Landelle
  • 6,990
  • 2
  • 23
  • 29
Huliganul
  • 71
  • 1
  • 9
  • What do you mean by bind information ? – dharmendra Apr 16 '15 at 10:32
  • some how add/store to that ws request the id of the edittext that i need to change info when onSuccess is called. For ex : i could have 5 edittext. I make a for loop ( 5 iteretions ) that generate 5 separete ws request. And i need when on onSuccess is called to know what edittext i need to modify. I can not send the id as a parameter because the ws is not in my control. – Huliganul Apr 16 '15 at 10:39
  • You can pass ID to each web service call which gives you back same id in response – dharmendra Apr 16 '15 at 10:40
  • can you please show me how? in a code – Huliganul Apr 16 '15 at 10:42

1 Answers1

0

I think you can go in the following way

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

}
Karthika PB
  • 1,373
  • 9
  • 16