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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:02:24+00:00 2026-06-03T17:02:24+00:00

Having trouble to start a new activity after progressbar have loaded. Im getting stucked

  • 0

Having trouble to start a new activity after progressbar have loaded. Im getting stucked at progressbar, dont know where I should put the new activity. Any solution to my problem?

ProgressBar myProgressBar;
int myProgress = 0;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    myProgressBar=(ProgressBar)findViewById(R.id.progressbar_Horizontal);

    new Thread(myThread).start();
}

private Runnable myThread = new Runnable(){

    public void run() {
        // TODO Auto-generated method stub
        while (myProgress<100){
            try{
                myHandle.sendMessage(myHandle.obtainMessage());
                Thread.sleep(50);
            }
            catch(Throwable t){

            }
        }
    }
    Handler myHandle = new Handler(){

        @Override
        public void handleMessage(Message msg) {
            // TODO Auto-generated method stub
            myProgress++;
            myProgressBar.setProgress(myProgress);
        }
    };
};

}

  • 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-03T17:02:26+00:00Added an answer on June 3, 2026 at 5:02 pm
    public void run() {
        //don't hard code things, use a constant for max progress value
        while ( myProgress<MAX_PROGRESS ){
            try{
                myHandle.sendMessage(myHandle.obtainMessage());
                //same
                Thread.sleep( SLEEP_TIME );
            } catch(Exception ex){
              //never live an empty catch statement, you are missing exceptions and
              //can't correct them
              Log.e( "MyCurrentClass", "Error during async data processing",e );
            }//catch
        }//while
        //start new activity here
        startActivity( MyClass.this, NewActivity.class );
    }//met
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting my ASP.NET application to start an application. For example
I am having trouble clearing my app's activity stack. At the start of my
I'm getting started with KIF and am having trouble testing my asynchronously loaded table
I'm having trouble with Web Start. There is no problem if I start the
Having trouble with the following segment of code. I'm getting a parameter count mismatch.
Having Trouble with Entity Framework. I have been populating EntityReferences with an EntityKey inorder
Having trouble with recursive methods in c#. When compiled it should just display the
Im having trouble finding out how to add a new window to an app
I'm having trouble setting up a new eclipse installation with the -vm option. I'm
I am new to JOGL but I am having trouble with the basics. I

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.