Saturday, 4 February 2012

How to set maximum volume programmatically In Android

While i am developing one application i was stuck how to the volume of an Android application to maximum, and I saw no of  post regarding this issue MediaPlayer.setValue function.

MediaPlayer.setValue( )
It's not the right function for setting the volume (see the help).

To set the volume to maximum i used below code it's working.

// 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);



Tags:volume increase in android,android volume,android mediaplayer volume increase,how to set maximum volume,android AudioManager volume setting,how to set max volume 

1 comment:

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...