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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:10:07+00:00 2026-06-08T23:10:07+00:00

I work for my license project, and one part consist in an android client.

  • 0

I work for my license project, and one part consist in an android client. All was ok, until I upgraded my phone to Android 4.0.4.

So, I have one AsyncTask. It looks like this:

public class TestTask extends AsyncTask<Context, Integer, Long> {

@Override
protected Long doInBackground(Context... params) {
    for (int i = 0; i < 10; i++) {
        System.out.println("nothing-" + i);
        if (i == 5) {
            TestTask2 testTask2 = new TestTask2();
            testTask2.execute(null);
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    return null;
}

}

This task wait 5 seconds, than it calls another async task, TestTask2.

public class TestTask2 extends AsyncTask<Context, Integer, Long> {

@Override
protected Long doInBackground(Context... params) {
    System.out.println("task 2 in action");
    return null;
}

}

In android 4.0.3 or lower, the output is:

nothing-0 nothing-1 nothing-2 nothing-3 nothing-4 nothing-5

task 2 in action

nothing-6 nothing-7 nothing-8 nothing-9

When I upgraded to 4.0.4, the second task doesn’t start until the first finished its job.

nothing-0 nothing-1 nothing-2 nothing-3 nothing-4 nothing-5 nothing-6 nothing-7 nothing-8 nothing-9
task 2 in action

Is there any thread policy in android 4.0.4, or something else? what could be the problem?

  • 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-08T23:10:09+00:00Added an answer on June 8, 2026 at 11:10 pm

    Thanks for the question. Apparently the default behavior has changed:
    https://groups.google.com/d/msg/android-developers/8M0RTFfO7-M/JZSHiOz9bPgJ

    You can get the old behavior by changing this:

    testTask2.execute(null);
    

    to this:

    testTask2.executeOnExecutor(THREAD_POOL_EXECUTOR, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Work on C# Desktop project,I have an account on paypal ,From my desktop application
I have begun work on a personal project that may end up having some
I have a WCF service with one method: [OperationContract] bool VerifyLicense(string clientId, string license);
Members at work have come across a C# project posted on Google code that
I have an MSM install with four (licensed) sites. Three of them work perfectly
Work on asp.net vs05. I have three type of value Like:IsDesign,IsPrinting,IsInstall they are bit
Work on this small test application to learn threading/locking. I have the following code,
I am working on a library and would like to dual license it: One
all I am making a new project in J2ME-Polish2.1.4 and when I create a
I have a custom Install method in a project where I'm loading a user's

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.