Loading...

Android Progress Bar Example

Android ProgressBar is one of the common user interfaces (UI) component. Progress bar is used to show progress of any task to the users like in downloading, uploading, loading etc. In this tutorial, I am going to show how to create a progress bar in android application to tell user that some task is running, how much task has already been finished and how much task is left or how much time is required to finish the task.

In this simple android application I have used android.widget.ProgressBar class to create and show progress of any task.

There are many ways to show progress in android application and here you will learn one of the simplest ways to show progress/running task to the user using ProgressBar.

Related:
Android Spinner Example
Dialog Libraries for Android Project
Android User Interface (UI) Design Tutorial

Android Example: How to Create and Show Progress Bar in Android


Following is the content of java activity file, XML layout file and so on.

XML Layout File


In this XML layout file, I have added a ProgressBar and a TextView. Progress bar is used to show a task in progress and TextView is used to show how much task has been finished and how much task is left. Following is the complete content of XML layout file.

res/layout/android_progress_bar_example.xml

Java Activity File


Following is the complete code of java activity file.

src/ProgressBarExample.java

Strings.xml File


res/values/strings.xml

Android Example: How to Create and Show Progress Bar in Android

Now run your Android Progress Bar Example application, you will see the progress bar and number count with the interval of one up to 100. When there is 100/100 the progress is completed.
XML 5913605474624004192
Home item