-2

如何創建一個進度條,以便應用程序在完成時從一個活動跳到下一個活動? (棒填充到100%)Android Studio:創建一個進度條,將導致100%下一個活動

從Android開發者網站,獲取我下面的代碼示例,但我不知道在哪裏/它是如何使應用程序轉到下一屏幕:

公共類MyActivity擴展活動{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(); 
} 

}

+0

我已編輯我的問題,包括我在這個過程中的位置。 – LaSpana101

回答

0
在你發佈的代碼

,你應該執行檢查時看到mProgressStatus爲100%,然後從當前Acrivity到你想要的活動啓動Intent

相關問題