In the programming guide section, you have seen how to create and use ProgressDialog.
In this section, you will learn how to customize ProgressDialog to satisfy your
requirements.
As you learn the following customization techniques, you can use the DemoUI to
try it out. To launch the DemoUI program, simply double click on the
progressdialog.jar.
Note: All the customization must be done after you create the progress dialog and before you call the beginTask method.
Initially, the progress dialog does not show up. After the first millisToDecideToPopup milliseconds (default 500, i.e., 0.5 second) the progress dialog will predict how long the operation will take. If it is longer than millisToPopup (default 1000, 1 second), the progress dialog then shows up.
You use the following code to configure these options:
1. ProgressDialog progressDialog = new ProgressDialog(DemoUI.this, “”);
2. // all the customization must be done after you create the progress dialog and before you call the beginTask method.
3.
4. progressDialog.millisToDecideToPopup = 400;
5. progressDialog.millisToPopup = 2000;
6. ...
7. progressDialog.beginTask(...
2. Display Estimated Remaining Time
By default, ProgressDialog displays the estimated remaining time. To turn it off, use:
progressDialog.displayTimeLeft = false;
3. Display Percentage in Progress Bars
To displays the percentage in the center of the progress bar, use: