Skip to content

Instantly share code, notes, and snippets.

@sudar
Created March 5, 2011 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudar/856282 to your computer and use it in GitHub Desktop.
Save sudar/856282 to your computer and use it in GitHub Desktop.
Adjusting volume in Android. Explanation of the code can be found at http://sudarmuthu.com/blog/adjusting-the-volume-in-android-through-code
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
//to decrease volume
audioManager.adjustVolume(AudioManager.ADJUST_LOWER, AudioManager.FLAG_PLAY_SOUND);
//to increase the volume
audioManager.adjustVolume(AudioManager.ADJUST_RAISE, AudioManager.FLAG_PLAY_SOUND);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment