Hi Gauridev,,,,use this code which is posted in anddev.org

       seekbar = (SeekBar) findViewById(R.id.seek);
           am = (AudioManager)
context.getSystemService(Context.AUDIO_SERVICE);
      /*     volume_label = (TextView) findViewById(R.id.volume);
           // Assign Curent Volume to Volume variable


           volume_label.setText(String.valueOf(volume));*/
           volume = am.getStreamVolume(AudioManager.STREAM_MUSIC);
           // Set the SeekBar to the have a proper Maximum volume.
           seekbar.setMax(am.getStreamMaxVolume(AudioManager.STREAM_MUSIC));

           // Set the seekbar's volume and create a Listener to auto
           // update the media volume as the slider is changed
           seekbar.setProgress(volume);
           seekbar.setOnSeekBarChangeListener(VolumeChange);


private OnSeekBarChangeListener VolumeChange = new
OnSeekBarChangeListener(){

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress,
                  boolean fromUser) {
            int index = seekbar.getProgress();
             am.setStreamVolume(AudioManager.STREAM_MUSIC, index, 1);
           //  volume_label.setText(String.valueOf(index));
        }
        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }
        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
   };

On Wed, Mar 17, 2010 at 3:42 PM, Gauri <[email protected]> wrote:

> Even I am facing some problem.
> I can set it from 0.1f to 0.9f , but unable to get it until unless I
> remember the last set value.
>
>
> On Mar 15, 11:23 pm, Bob Kerns <[email protected]> wrote:
> > That's really not the same thing. It's a monaural setting that affects
> > ALL streams of that type, while the interface he's asking about it is
> > stereo and affects just the one MediaPlayer.
> >
> > My suggestion is to simply remember what you set it to. My guess is
> > that it starts out at 1.0, 1.0, but you can set it to that yourself
> > after you create it.
> >
> > On Mar 15, 2:36 am, kavitha sunil <[email protected]> wrote:
> >
> >
> >
> > > AudioManager audMgr = getSystemService(Context.AUDIO_SERVICE);
> > >   intvolume= audMgr.getStreamVolume(AudioManager.STREAM_MUSIC);
> > > Change the argument to getStreamVolume accordingly.
> >
> > > On Mon, Mar 15, 2010 at 1:48 PM, kavitha <[email protected]> wrote:
> > > > Hi All,
> >
> > > > I am developing an application of musicplayerinandroid.
> >
> > > > I need to showvolumecontrol in my application.
> >
> > > > I saw as per documentation,MediaPlayervolumeis 0-1.
> >
> > > > I saw one method as MediaPlayer.setVolume<
> http://developer.android.com/reference/android/media/MediaPlayer.html..
> .>(float
> > > > leftVolume, float rightVolume)  to set thevolumefor mediaplayer.
> >
> > > > But I need to show currentvolumealso in slider,,,there is no method
> to
> > > >getcurrentvolume.
> >
> > > > Any idea how togetit???
> >
> > > > Thanks
> > > > Kavitha
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "AndroidDevelopers" group.
> > > > To post to this group, send email
> [email protected]
> > > > To unsubscribe from this group, send email to
> > > >[email protected]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to