Android ProgressBar
We can display the android progress bar dialog box to dislay
the status of work being done e.g. downloading file, analyzing status of work
etc.
Here, I am going to display the progress dialog for dummy
file download operation.
Here I am using android.ap.ProgressDialog class to show the
progress bar, Android ProgressDialog is the subclass of AlertDialog class.
The ProgressDialog class provides method to work on progress bar
like setProgress(), setMessage(), setProgressStyle(), show() etc. The progress
range of Progress Dialog Is 0 to 10000.
How to define ProgressDialog
ProgressDialog
progressBar=new ProgressDialog(this);
progressBar.setCancelable(true);
//you can cancel it by pressing back button
progressBar.setMessage(“File
downloading…”);
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
//initially progress is 0
progressBar.setMax(100);
//set the maximum value 100
progressBar.show();//dislay
the progress bar
No comments:
Post a Comment