Skip to content
Related Articles

Related Articles

How to Implement Circular ProgressBar in Android?

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 06 Apr, 2021
Improve Article
Save Article

ProgressBar is used when we are fetching some data from another source and it takes time, so for user’s satisfaction, we generally display them the progress of the task. In this article, we are going to learn how to implement the circular progress bar in an android application using Java. So, this article will give you a complete idea of implementing a circular progress bar in an application built in Android Studio. So, without wasting further time let’s go to the article and read how we can achieve this task.

What we are going to develop in this article?  

We will be building a simple application in which we will be implementing a circular progress bar with a text display. A sample video is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language.  

 Implement Circular ProgressBar in Android Sample GIF

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Create circular_progress_bar.xml

Navigate to the app > res > drawable > right-click and select new > drawable resource file and name the new XML file as circular_progress_bar.xml and refer to the following code. Comments are added inside the code to understand the code in more detail.


<?xml version="1.0" encoding="utf-8"?>
    <!--styling the progress bar-->
            android:useLevel="false" />

Step 3: Create circular_shape.xml

Similarly, create a new drawable resource file and name the file as circular_shape.xml and refer to the following code.


<?xml version="1.0" encoding="utf-8"?>
    <solid android:color="@color/colorPrimary" />

Step 4: Working with the activity_main.xml file

Now it’s time to design the layout of the application. So for that, navigate to the app > res > layout > activity_main.xml and refer to the code written below. 


<?xml version="1.0" encoding="utf-8"?>
        <!--progress bar implementation-->
            android:textAlignment="center" />
        <!--Text implementation in center of the progress bar-->
            android:textStyle="bold" />

Step 5: Working with the file

Go to the app > java > package name > file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.os.Bundle;
import android.os.Handler;
import android.widget.ProgressBar;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
    private ProgressBar progressBar;
    private TextView progressText;
    int i = 0;
    protected void onCreate(Bundle savedInstanceState) {
        // set the id for the progressbar and progress text
        progressBar = findViewById(;
        progressText = findViewById(;
        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() {
                // set the limitations for the numeric
                // text under the progress bar
                if (i <= 100) {
                    progressText.setText("" + i);
                    handler.postDelayed(this, 200);
                } else {
        }, 200);

That’s all, now the application is ready to install on the device. Here is what the output of the application looks like.


GitHub Link:

The project is available on GitHub, you can access it by following the link below: Circular Progress Bar in Android Application

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!