VOOZH about

URL: https://www.geeksforgeeks.org/kotlin/progressbar-in-android/

⇱ ProgressBar in Android - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ProgressBar in Android

Last Updated : 23 Jul, 2025

Progress Bar are used as loading indicators in android applications. These are generally used when the application is loading the data from the server or database. There are different types of progress bars used within the android application as loading indicators. In this article, we will take a look at How to use the ProgressBar in android. A sample video is given below to get an idea about what we are going to do in this article. This Android article covered in both Java and Kotlin languages.

👁 Progress-Bar

Types of Progress Bar:

  1. Horizontal Progress Bar (Determinate) - A linear progress indicator that moves from left to right. Suitable when the progress of a task can be measured (e.g., file download or data processing). Requires setting a maximum value and updating the progress accordingly.
  2. Circular Progress Bar (Indeterminate) - A spinning circular indicator used when the duration or progress of a task is unknown. Ideal for operations where you cannot predict the completion time (e.g., loading content from the network).

Step by Step Implementation

Step 1: Create a New Project in Android Studio

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.

Step 2: Working with the activity_main.xml file

Navigate to app > res > layout > activity_main.xml and add the below code to it. Comments are added in the code to get to know in detail.

activity_main.xml:

Design UI:

👁 design-ui-progress-bar


Step 3: Working with the MainActivity file 

Navigate to app > java > your app's package name > MainActivity file and add the code below. Comments are added in the code to get to know in detail. 

MainActivity File:

Output:

Comment
Article Tags:

Explore