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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:05:22+00:00 2026-06-05T02:05:22+00:00

After the splash screen, it takes about 6 sec to load onCreate contents in

  • 0

After the splash screen, it takes about 6 sec to load onCreate contents in the Main activity. So I want to show a progress dialog while loading and here’s what I did:

import ...

private ProgressDialog mainProgress;

public void onCreate(Bundle davedInstanceState){
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    mProgress = new ProgressDialog (Main.this);
    mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgress.setMessage("Loading... please wait");
    mProgress.setIndeterminate(false);
    mProgress.setMax(100);
    mProgress.setProgress(0);
    mProgress.show();

    ---some code---

    mProgress.setProgress(50);

    ---some code---

    mProgress.setProgress(100);
    mProgress.dismiss();
}

and it doesn’t work… the screen stays black for 5-6 sec and then load the main layout. I dont know which part I did wrong :*(

  • 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-05T02:05:23+00:00Added an answer on June 5, 2026 at 2:05 am

    You need to do start your busy code in an other thread (than the UI thread).
    In your activity create the ProgressDialog and close it in the thread

    mProgress = new ProgressDialog (Main.this);
    
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            // code that needs 6 seconds for execution
    
            // after finishing, close the progress bar
            mProgress.dismiss();
        }
    };
    
    new Thread(runnable).start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The first activity in my app is a splash screen with a Progress Dialog
In my App, first it shows a splash screen. After that another activity, then
I want to add fade in and fade out to a splash screen after
I want to show a splash Screen before the App lunch. First I make
I have a Default.png for my splash screen image at my iphone app. After
We are creating a video for a splash screen with After Effects. We have
Everytime I try to run my application on an emulator, after the splash screen
In my app I am using animation for splash screen. this animation stops after
i m getting the splash screen on the iphone device even after removing the
I want to play the video as splash screen.I have implement the play video

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.