-1

enter image description here

above you can see two Images . when I click on left side image, Sound become 0 and when I click on right side Image ,sound become Highest.

please help me to solve this.

I had try only this much for seekbar of volume, that works well ...

volumeSeekbar = (SeekBar) v.findViewById(R.id.volseekbar);
            audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
            volumeSeekbar.setMax(audioManager
                    .getStreamMaxVolume(AudioManager.STREAM_MUSIC));
            volumeSeekbar.setProgress(audioManager
                    .getStreamVolume(AudioManager.STREAM_MUSIC));


            volumeSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                @Override
                public void onStopTrackingTouch(SeekBar arg0) {
                }

                @Override
                public void onStartTrackingTouch(SeekBar arg0) {
                }

                @Override
                public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
                    audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
                }
            });
Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50
  • Can't provide code writing service. What have you tried so far? – Rohit5k2 Feb 09 '16 at 11:19
  • Besides the linked question, you can also read more about controlling the volume in the [AudioManager docs](http://developer.android.com/reference/android/media/AudioManager.html) – Siddharth Lele Feb 09 '16 at 11:23
  • How is your whole UI built? Are the Mute- and Max-Volume elements are buttons? Do you have an onClickListener on this buttons? – Christopher Feb 09 '16 at 12:54

1 Answers1

0

This post talks about various ways of implementing a volume seeker and I believe it is what you are looking for. Using SeekBar to Control Volume in android?

Community
  • 1
  • 1
Glenn Werner
  • 2,048
  • 2
  • 12
  • 16