2012-10-09 61 views

回答

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 
+0

對不起,我不明白,你可以請給出完整的代碼 – Ravikumar11

+0

這是所有的代碼。將所有返回的數據保存到arrayList的不同位置。在onPostExecute方法中,參數'param'是您在'doInBackground'中創建的arrayList。 – moskis