0
我正在致力於AsynTask
,來自AsynTask
的單個url調用很好,但我想在AsyncTask
之後調用兩個Web服務,請問您可以發送一些代碼或想法。Android調用AsyncTask中的多個Web服務
我的代碼:
public class GetInstructionItems extends AsyncTask<String, Void, Boolean> {
public ProgressDialog myProgressDialog = null;
private Boolean authenticationResult = false;
private String LOG = SurgicalHistoryAsynTask.class.getName();
private String responseString = "getInstructionItemsResult";
JSONObject totalResult;
protected Boolean doInBackground(String... params)
{
return getRespose(params[0]);
}
protected void onPostExecute(Boolean result) {
myProgressDialog.dismiss();
if (result)
{
Log.d(LOG, "Response ::result "+result);
}else{
showAlertMsg(getString(R.string.response_fail));
}
}
protected void onPreExecute() {
if (!authenticationResult) {
myProgressDialog = new ProgressDialog(getActivity());
myProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
myProgressDialog.setMessage("loading...");
myProgressDialog.setCancelable(false);
myProgressDialog.setProgress(100);
myProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
myProgressDialog.show();
}
}
private boolean getRespose(String inputUrl){
return true;
}
}
如果 「從AsynTask單一的URL調用是好的」,然後就做twice..and你有兩個網址電話。 – YuviDroid
我們可以從同一個Asynctask調用兩個Web服務調用嗎? – Ravikumar11