0

私は問題なくAsynTask単一のURL呼び出しに取り組んでいますが、 AsynTask2つの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;
    }
}
4

1 に答える 1

0
protected Boolean doInBackground(String... params) 
{
    getRespose(params[0]);
    getRespose(params[1]);
    getRespose(params[2]);
    return true;
}

また

class Responces
{
     boolean r1, r2, r3;
}


protected Responces doInBackground(String... params) 
{
    Responces r = new Responces();

    r.r1 = getRespose(params[0]);
    r.r2 = getRespose(params[1]);
    r.r3 = getRespose(params[2]);
    return r;
}
于 2012-10-02T13:27:43.410 に答える