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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:02:28+00:00 2026-05-26T13:02:28+00:00

I am using the following code to show dynamic progress dialog : public void

  • 0

I am using the following code to show dynamic progress dialog :

public void loading()
{
     final int WelcomeScreenDisplay=1000;
     progressDialog = new ProgressDialog(this);
     progressDialog.setCancelable(true);

     progressDialog.setMessage("Loading...");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
   progressDialog.incrementProgressBy(10);
    progressDialog.show();



     Thread WelcomeThread=new Thread()
     {
        int wait=0;
        public void run()
        {
            try
            {
                super.run();
                while(wait<WelcomeScreenDisplay)
                {
                     sleep(100);
                          //  progressDialog.setProgress(0);
                     progressDialog.incrementProgressBy(10);    
                        wait+=100;

                }
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }

        }
     };
     WelcomeThread.start();
}

but there is some problem as:
1) when calling this function on button click,then loading bar is displayed after 10-15 seconds and
2) When user enter username and password and click on login button, then progress bar is being displayed and using intent when activity jump from Login page to another,then while loading the dynamic contents of 2nd page,a blank screen is display in between both the pages for 1-2 mins

I wanted to know that what changes I will implement so that this blank screen should not come…and my application jumps from 1 page to another when the loading completes.

  • 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-26T13:02:29+00:00Added an answer on May 26, 2026 at 1:02 pm

    Use AsyncTask whenever you are performing such operations . Here is a sample

    class eval extends AsyncTask<Void,Void,Void>
    {
    
        ProgressDialog d;
    
        @Override
        protected void onPreExecute()
        {
            super.onPreExecute();
            d=ProgressDialog.show(MainScreen.this,"Please Wait","Populating  content...",true);
        }
    
        @Override
        protected void doInBackground(Void... params) 
        {
            //perform the required operation of fetching contents
            return null;
        }
    
        @Override
        protected void onPostExecute(Void result) 
        {
            super.onPostExecute(result);
            d.dismiss();
            // now call the required Activity
    
        }
    }
    

    Now in your program to call this task you need to do this

    new eval().execute();
    

    Make sure you do not have any operation in the main UI thread after this statement

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

Sidebar

Related Questions

I am using the following code to show a jQuery UI dialog when the
I'm using the following code in an attempt to show a dialog with a
I am using following code to show location of the objects. - (void)viewDidLoad {
I'm currently using the following code to show / hide a ProgressDialog in my
I am using the following code to show percentage using String.Format but I also
I'm using the following code to show a particular UITableView: the first row must
I am using the following code to show and hide two div positioned absolutely
I am using the following code public class Img extends Activity { /** Called
I am using the following code to show a follow me box to the
I'm using the following code to show a box when you mouseover a certain

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.