hi love this - when i use it - it is closing after reaching 100 but also closing whole app - what am i doing wrong please?
public void doProgressDialog() {
ProgressDialog progressDialog = new ProgressDialog(this);
// Set horizontal progress bar style.
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
// Set progress dialog message.
progressDialog.setMessage("This is a horizontal progress dialog.");
// The maxima progress value.
progressDialog.setMax(100);
// Whether progress dialog can be canceled or not.
progressDialog.setCancelable(true);
// Popup the progress dialog.
progressDialog.show();
// Create a new thread object.
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
// Update progress bar every 0.3 second.
while (i < 100) {
try {
Thread.sleep(30);
// Update the progress value.
progressDialog.incrementProgressBy(1);
// Update the secondary progress value.
progressDialog.incrementSecondaryProgressBy(5);
i++;
} catch (Exception ex) {
ex.printStackTrace();
}
}
// Close and delete the dialog when the progress bar is finished
progressDialog.dismiss();
}
});
// Start the thread.
thread.start();
}
hi love this - when i use it - it is closing after reaching 100 but also closing whole app - what am i doing wrong please?
public void doProgressDialog() {
ProgressDialog progressDialog = new ProgressDialog(this);
// Set horizontal progress bar style.
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
// Set progress dialog message.
progressDialog.setMessage("This is a horizontal progress dialog.");
// The maxima progress value.
progressDialog.setMax(100);
// Whether progress dialog can be canceled or not.
progressDialog.setCancelable(true);
// Popup the progress dialog.
progressDialog.show();
// Create a new thread object.
Thread thread = new Thread(new Runnable() {