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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:51:46+00:00 2026-05-25T17:51:46+00:00

Every time I do a httpRequest , the screen will appear to be locked

  • 0

Every time I do a httpRequest, the screen will appear to be locked up for a few seconds while the code is executing. Hence I used AsyncTask to do all my httpRequest stuff in a separate thread while putting up a ProgressDialog so the user knows something is happening.

I recently encountered the following situation: the input of one of my httpRequest is dependent on the result from a previous httpRequest (+parse) action. I can’t just put the two AsyncTasks sequentially cause Android will put them in two threads and start the second one without the first one being finished. And without an appropriate input (the result of the first httpRequest), my second httpRequest will crash the app.

Is there way I can put-in a wait() to force the second AsyncTask not to start until the first one finishes?

  • 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-25T17:51:46+00:00Added an answer on May 25, 2026 at 5:51 pm

    I also had some same situation the other day.
    I had solved it in this way:
    Pass the reference of your activity to the constructor of async class and execute the do in background function. Now in post execute function call a public method of ur activity from async class to execute the task again… or try this:

                if (asynclass.getStatus() == android.os.AsyncTask.Status.PENDING) {
                    asynclass.execute();
                } else if (RF.getStatus() == android.os.AsyncTask.Status.FINISHED) {
                    asynclass = new asyncclass();
                    asynclass.execute();
                } else {
                    Toast.maketoast(this, "Plz wait", 1).show();
                }
    

    Cheers

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

Sidebar

Related Questions

I am trying with program code from http://liboauth.sourceforge.net/tests_2oauthexample_8c-example.html but every time I am getting
Every time I turn on my company-owned development machine, I have to kill 10+
Every time I create a new project I copy the last project's ant file
Every time I create an object that has a collection property I go back
Every time I need to work with date and/or timstamps in Java I always
Every time I have to estimate time for a project (or review someone else's
Every time a user posts something containing < or > in a page in
Every time I try to run a small application that uses a Derby DB
Every time I call this method my NSMutableData is leaking and I cannot figure
Every time I make a project I develop several generic routines/modules/libraries that I expect

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.