Android SeekBar example


In this tutorial , we are going to see Android SeekBar example.

SeekBar is extension of ProgressBar. You can drag cursor left or right to select correct value. It is generally used in setting brightness or music progress or setting sound.
It is very easy to create SeekBar in Android. Just follow below steps to create SeekBar.

Source code:

Step 1 :Creating Project

Create an android application project named “SeekBarExampleApp”.

Step 2 : Creating Layout

Change res ->layout -> activity_main.xml as below:

Step 3 : Creating MainActivity

Change src/main/packageName/ as below:

We are getting widget reference from layout file and then using SeekBar’s setOnSeekBarChangeListener method to set listener for our seekbar.

Step 4 : Running the app

When you run the app, you will get below screen:

Drag ping circle and use it to set the value for SeekBar.

We are done with Android SeekBar example.
Happy Android Learning !!


Add Comment