-2

How does one create a progress bar that will allow the application to jump from one activity to the next upon being completed? (bar filled to 100%)

From the Android Developers site, I retrieved the following example code, but I'm not sure where/how it makes the app go to the next screen:

public class MyActivity extends Activity { private static final int PROGRESS = 0x1;

 private ProgressBar mProgress;
 private int mProgressStatus = 0;

 private Handler mHandler = new Handler();

 protected void onCreate(Bundle icicle) {
     super.onCreate(icicle);

     setContentView(R.layout.progressbar_activity);

     mProgress = (ProgressBar) findViewById(R.id.progress_bar);

     // Start lengthy operation in a background thread
     new Thread(new Runnable() {
         public void run() {
             while (mProgressStatus < 100) {
                 mProgressStatus = doWork();

                 // Update the progress bar
                 mHandler.post(new Runnable() {
                     public void run() {
                         mProgress.setProgress(mProgressStatus);
                     }
                 });
             }
         }
     }).start();
 }

}

1 Answers1

0

in the code you've posted, you should perform a check to see when mProgressStatus is 100% and then start an Intent from current Acrivity to the activity you desire.

JuLes
  • 251
  • 1
  • 14