List of usage examples for android.media AudioManager adjustVolume
public void adjustVolume(int direction, int flags)
From source file:Main.java
public static final void audioVolumeRaise(Context ctx) { AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); audio.adjustVolume(AudioManager.ADJUST_RAISE, 0); }
From source file:edu.stanford.mobisocial.dungbeetle.ui.fragments.AppsViewFragment.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) { if (!event.isTracking()) { return true; }/* ww w.j a v a 2 s. c o m*/ if (!event.isLongPress()) { AudioManager audio = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); audio.adjustVolume(AudioManager.ADJUST_RAISE, AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI); return true; } } if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN) { if (!event.isTracking()) { return true; } if (!event.isLongPress()) { AudioManager audio = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); audio.adjustVolume(AudioManager.ADJUST_LOWER, AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI); return true; } } return false; }
From source file:github.daneren2005.dsub.service.DownloadService.java
public void updateRemoteVolume(boolean up) { AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.adjustVolume(up ? AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);/*ww w. j a v a 2 s.c o m*/ }