SeekBar in android

Shital Awathe

Objective :

  • How to use SeekBar
  • How to use AudioManager with SeekBar
  • How to change your android device volume using AudioManager and SeekBar

A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys.

Here I have created android project name SeekBarDemo.I work on two main files and they are

  1. activity_main.xml
  2. MainActivity.java

activity_main.xml used to place seekBar demo in android layout. The code for activity_main.xml file is given below.

  • activity_main.xml :

MainActivity.java showes how to use SeekBar and AudioManager to control the volume of android device. following is a code for MainActivity.java
  • MainActivity.java

Here I set different stream with this activity. Here I set audio stream for music, ring, alarm and for notification. And called initControls() method, the code for initControls() is given below.
  1. First line showes…

View original post 88 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s