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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:50:08+00:00 2026-05-30T21:50:08+00:00

I have an app in which the app flow is different from Android standard:

  • 0

I have an app in which the app flow is different from Android standard:

  • Standard: Pressing a button on activity A and showing loading on this activity while loading the data and building the views of activity B and only then show the next activity.
    (Call AsyncTask on activity A, when finished send data and call activity B)

  • What I need: Press the button on activity A, go to activity B, and while showing loading, update the view of Activity B behind the loading.
    (Move from activity A to B and there call AsyncTask while showing loading. When AsyncTask is finished update the view while the loading is on front thus showing the view update process)

Problem: This will make the loading icon stop.. and sometimes show the unresponsive dialog (due to the long taking of the operation) and using the UI thread to change a view that is being built.

I’ve read some questions about the same matter: Android: how to update UI dynamically?

But none has provided a generic answer.

If you answer is “that’s not the recommended behaviour” i’ll agree… but these are requirements so i’ll really appreciate some help 😀

  • 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-30T21:50:09+00:00Added an answer on May 30, 2026 at 9:50 pm

    I first did this already a year ago in a project. I got this very same problem because I’ve tried to use an icon, and there were so much to be updated that the icon freezed sometimes, so I ended up using a Handler paired with AsyncTask. It’s actually a very common pattern in pre-setup activities.

    Those are the steps:

    1. Create a loading dialog, posting it to a Handler object. You could use something like this (a Loading dialog instead of a Toast, obviously).
    2. Start your AsyncTask doing your computations.
    3. Whenever the parts of the computation are ready, you publishProgress. Give flags to the code in order to tell it exactly which parts of the UI need to be build. You’ll see the UI being build behind while your loading dialog is displaying and spinning.
    4. When everything is done, you dismiss the dialog in onPostExecute.

    Below is a sample code that does exactly what you describe:

    private void settingsAndPlaceTaskStart() {
    
        // loading dialog
        startLoading();
    
        new AsyncTask<Context, Integer, Void>() {
            @Override
            protected Void doInBackground(Context... context) {
    
                // check and prepare settings integrity
                Settings st = new Settings(context[0], false);
                st.checkPreferencesIntegrity();
    
                // set text for each view / paired object
                // this will take a long time
                do {
                    // ... removed for clarity
                    int code = ...;
                    publishProgress(mObjects.getViewByCode(code));    
                    while (mObjects.getNext());
                return null;
            }
    
            @Override
            protected void onPostExecute(Void void) {
                // finish stuff
            }
    
            @Override
            protected void onProgressUpdate(Integer... message) {
                prepareView(message[0]);
            }
    
        }.execute(getActivity());
    }
    

    Here the Loading does not suffer from any stutter while the progress is spinning in the dialog. The dialog stays in the foreground until the onPostExecute. You should dismiss the dialog in there, following the end of the task.

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

Sidebar

Related Questions

I have an app which could benefit from the user being able to choose
I have an app which consists of several different assemblies, one of which holds
I am developing a Facebook app. I have a server side OAuth flow which
I have an app (cms) which structure is like this: BASE: /application/ /public/ themes/
I have wxPython app which is running on MS Windows and I'd like it
I have an app which uses a keyboard hook procedure in a library. The
I have an app which is quite huge. It has tons of images and
I have an app which acts almost like a daemon. Sometimes it quits on
I have an app which contains a scrollview with several tableviews. Each tableview is
I have an app which generates some files in the app directories I need

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.