Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3724226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:33:48+00:00 2026-05-19T06:33:48+00:00

I needs to make a call to a webservice for 5 times(as there are

  • 0

I needs to make a call to a webservice for 5 times(as there are 5 different parameters) one by one or all at once. Once a particular call completed, in background a textview should be updated with text as: “1st completed”, “2nd Completed” and so on.

TextView value should be updated in background.

What should i do ? I am knowing the concept of AsyncTask, but i am confused that should i write 5 AsyncTask and then for each i write execute() method to execute the AsyncTask?

I am successful for only 1 one call, as i set “1st completed” in postExecute() method. But confused for the 5 times call.

Please suggest me a better way or exact solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T06:33:50+00:00Added an answer on May 19, 2026 at 6:33 am

    You only need 1 AsyncTask, you have to do all 5 calls in the doInBackground() and everytime you complete one call the publishProgress passing for example the number of the completed call, then, at the end do whatever you need in onPostExecute.

    A simple approach:

    private class ServiceCallTask extends AsyncTask<String, Integer, Void> {
    
        protected void onPreExecute() {
            //prepare whatever you need
            myTextField.setText("starting calls");
        }
    
        protected Void doInBackground(String... params) {
            //process params as you need and make the calls
            doCall1();
            publishProgress(1); //this calls onProgressUpdate(1)
            doCall2();
            publishProgress(2);
            doCall3();
            publishProgress(3);
            doCall4();
            publishProgress(4);
            doCall5();
            publishProgress(5);
            return;
        }
    
        protected void onProgressUpdate(Integer... progress) {
            //this runs in UI thread so its safe to modify the UI
            myTextField.append("finished call " + progress);
        }
    
         protected void onPostExecute(Void unused) {
            myTextField.append("all calls finished");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a procedure (procA) which needs to call a webservice many times and
In my WP7 app I use HttpWebRequest class to make http call to webservice
I need to make a call to a json webservice from C# Asp.net. The
I am Using Spring WebServiceTemplate to make webservice call which uses JAXB to generate
For executing array methods on NodeList objects(Array like) we need to make indirect call
I need to make something(i call it a scheduler) that checks the time of
I want to make an ajax call to server. I need to fetch the
My program needs to make use of void* in order to transport data or
I have an activity which needs to make two remote server calls. The first
I have a Flash program that needs to make url requests to send data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.