如何从单个 Asynctask 调用多个 Web 服务调用,在此先感谢。
问问题
1368 次
1 回答
2
它们是同步的吗?然后打电话给第一个,第二个...
public class WSTask extends AsyncTask<Void,Void,AccountsOverview_LABean>{
@Override
public void onPreExecute(){
// show progress dialog or something if you want.
}
@Override
protected ArrayList<Object> doInBackground(Void... params) {
try{
ArrayList<Object> a=new ArrayList<Object>();
a.add(WebService1()); // WebService1 returns the data that you want
a.add(WebService2()); // WebService1 returns the data that you want
a.add(WebService2()); // WebService1 returns the data that you want
return a
d.cancel();
}
return null;
}
@Override
protected void onPostExecute(ArrayList<Object> param){
// stop loading icon or loading dialog...
// Manage the content of the arrayList like you need.
}
} //WSTask
于 2012-10-09T12:22:25.717 回答