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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:44:02+00:00 2026-05-30T22:44:02+00:00

Currently, my app starts with a menu. Once a menu item is clicked, it

  • 0

Currently, my app starts with a menu. Once a menu item is clicked, it starts a Activity which grabs content from an online API.

The problem I am having is, once the menu item is clicked, the application waits until the http request and response is complete before it displays the activity.

My Question is, How can I have the Activity display instantly with the layout and static View. Then once the activity is loaded, then I start fetching data from an API?

  • 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-30T22:44:03+00:00Added an answer on May 30, 2026 at 10:44 pm

    Why run after when you can run concurrently!!

    Use an AsyncTask in your onCreate()/onResume() method.

    public void onCreate(Bundle b) {
        super.onCreate(b);
        setContentView(...);
    
        AsyncTask task = new MyTask();
        task.execute(/* optional params */);
    }
    

    In your implementation of MyTask, put your long running code (the data fetched from the http request) into the doInBackground() method. Once the doInBackground() method returns, you can update your View in onPostExecute().

    Also, take a look at Painless Threading, as there is lots of helpful android threading information in there.

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

Sidebar

Related Questions

When my iPhone app starts up, the main screen has a keyboard. Currently the
My app currently uses OAuth to communicate with the Twitter API. Back in December,
I currently have an app deployed on Heroku which runs on two web dynos
I'm developing an app that starts with a main menu, and then continues through
I'm an Android newbie, and working on an app which needs an Options menu.
Currently my app pulls data from an Microsoft SQL 2005 database via ASP.NET XML
I'm working on some automatic update check code which runs when my app starts
im currently developing an app which plays the steam audio using MediaPlayer class. And
Possible Duplicate: Programmatically delete my own app Currently I am working on a iphone
I currently have a app on the market it saves some data with onRetainNonConfigurationInstance

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.