I searched a bit how to the volume of an Android application to maximum, and I saw few post regarding people asking about MediaPlayer.setValue function.
It's not the right function for setting the volume (see the help).
To set the volume to maximum (or any relative value):
// Get the AudioManager
AudioManager audioManager =
(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
// Set the volume of played media to maximum.
audioManager.setStreamVolume (
AudioManager.STREAM_MUSIC,
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
0);
Friday, July 2, 2010
Subscribe to:
Post Comments (Atom)
5 comments:
HI
Thanks,I will the above method.
HI
Thanks,I will the above method.
(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
hows me an error. i am not using onCreate function.
this.getSystemService(Context.AUDIO_SERVICE);
im getting an error in this line ;
Post a Comment