1

I'm new to Android programming.

I need to make several calls from http internet. When all calls are terminated I can then proceed with the mainactivity to analyze the data.

I was wondering how I can create different classes AsynTask and verify that all of them have completed the tasks in the background? Is it possible call all these asyntask in another asynctask and check when all are completed?

Thank you

  • Can you try this way http://stackoverflow.com/questions/26937254/execute-a-function-when-all-async-http-requests-are-finished/26937666#26937666 – Chitrang Jan 27 '15 at 10:51

1 Answers1

0

You just need to call another async task from one like this :

private class PendingTask extends AsyncTask<Void, Void, Void>{

        @Override
        protected Void doInBackground(Void... params) {
            // TODO Auto-generated method stub
            // dO what you want to do
        }
        @Override
        protected void onPostExecute(Void result) {
            // TODO Auto-generated method stub
            pb.setVisibility(View.GONE);
            new TodayTask().execute(); // Call TodayTask asynctask for next service call
        }

Call number of asynctask and do your work. It execute one after another asynctask.

SANAT
  • 8,489
  • 55
  • 66