Turn volume Down - Android android.media

Android examples for android.media:Volume

Description

Turn volume Down

Demo Code

import android.media.AudioManager;

public class Main {

  public static void volumeDown(AudioManager am) {
    int currentVolumn = am.getStreamVolume(AudioManager.STREAM_MUSIC);
    if (currentVolumn > 0) {
      am.setStreamVolume(AudioManager.STREAM_MUSIC, currentVolumn - 1, AudioManager.FLAG_PLAY_SOUND);
    }//from w w w  .  j a  v  a2s.com
  }

}

Related Tutorials