Android ProgressBar

Categories: Android // Tags: , .
Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon1

We can display the android progressbar dialog box to display the status of work being done e.g. downloading file, analyzing status of work etc.In this example, we are displaying the progress dialog for dummy file download operation.Here we are using android.app.ProgressDialog class to show the progress bar. Android ProgressDialog is the subclass of AlertDialog class.The ProgressDialog class provides methods to work on progress bar like setProgress(), setMessage(), setProgressStyle(), setMax(), show() etc. The progress range of Progress Dialog is 0 to 10000.

Let’s see a simple example to display progress bar in android.

Android Progress Bar Example by ProgressDialog

Let’s see a simple example to create progress bar using ProgressDialog class.

activity_main.xml

Drag one button from the pallete, now the activity_main.xml file will look like this:

File: activity_main.xml

 

Activity class

Let’s write the code to display the progress bar dialog box.

File: MainActivity.java

Output:

Android ProgressBar

Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon1

About Team

Browse Archived Articles by Team