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 8987903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:54:07+00:00 2026-06-15T21:54:07+00:00

The problem I have is concerning two separate Asynctask classes. The first asynctask uses

  • 0

The problem I have is concerning two separate Asynctask classes. The first asynctask uses a network operation in doInBackground method

HttpResponse httpResponse = httpClient.execute(httpPost);

while the other is a thread for loading images with a progressDialog.

so what happens is if I am using a slow internet connection (so that means the first asynctask hasn’t finished yet) and then go directly to the second asynctask, the second class will wait until the first one is finished.

btw, right after I call the first asynctask I directly finish the activity and call another one does this have to do with anything?

tl;dr version:

second asynctask won’t do the doinbackground process until the first asynctask is done

I know this because the progress dialog is shown for a long time (which I show it in preExecute and dismiss it in postexecute)

EDIT:

the first asynctask involves waiting for a response from the net. so while there isn’t a response the second asynctask won’t do its doinbackground process.

EDIT 2:

Is there a way for me to properly use these 2 asynctask so the second one won’t have to wait for the first to finish?

  • 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-06-15T21:54:08+00:00Added an answer on June 15, 2026 at 9:54 pm

    I had same problem in my app – i needed to run 4 AsyncTasks concurrently in any Android version (from 2.1 – to 4.2). But from Honeycomb, AsyncTasks run in serial.

    So i had wrote AsyncTaskExecutor – it can runs AsyncTasks concurrently on any Android version.

    Take a look:

    AsyncTaskExecutor

    It takes all work for running AsyncTask concurrently on any Android OS version, it is better that using:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
        task.execute();
    }
    

    Because AsyncTask.THREAD_POOL_EXECUTOR available only on api >= 11; I`m using own threadPoolExecutor instance

    With AsyncTaskExecutor you just need to write:

    AsyncTaskExecutor.executeConcurrently(task, params);
    

    And that is all. No errors on Android 2.x, 3.x and 4.x

    P.S. I am sorry for copying my answer from other question, but I think, it will be helpful

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem concerning a select query in MYSQL i have two different
I have two questions concerning fitting a gauss curve to histogram peaks. My first
I've got a problem concerning android layouts. In my xml file I have two
I have a problem concerning delegates in a Windows Forms application. There are two
I have problem concerning python packages and testing. I'm writing an application using wx
I have a problem concerning a HashMap in Java. To explain the problem in
I have a problem concerning the width of a DialogPreference in Android. According to
I am using LaTeX and I have a problem concerning string manipulation. I want
i am currently working on a facebook game and i have a problem concerning
I'm a beginner concerning socket programming and I have a problem when I send

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.