ProgressBar was added in API Level 1
Visual indicator of progress in some operation. Displays a bar to the user representing how far the operation has progressed; the application can change the amount of progress (modifying the length of the bar) as it moves forward. There is also a secondary progress displayable on a progress bar which is useful for displaying intermediate progress, such as the buffer level during a streaming playback progress bar.A progress bar can also be made indeterminate. In indeterminate mode, the progress bar shows a cyclic animation without an indication of progress. This mode is used by applications when the length of the task is unknown. The indeterminate progress bar can be either a spinning wheel or a horizontal bar.
1. In the MainActivity.java file, add the below line to the imports section.
import android.widget.ProgressBar;
2. Add the below line to the onCreate method. This will declare a new ProgressBar named myProgressbar. Declare the ProgressBar at the class level if you'd like set the ProgressBar in the SensorEventListener.
ProgressBar myProgressBar;