我正在处理AsynTask
,单个 url 调用AsynTask
很好,但我想一个接一个地调用两个 Web 服务AsyncTask
,请你发送一些代码或想法。
我的代码:
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;
}
}