Java tutorial
//package com.java2s; //License from project: LGPL import android.content.Context; import android.media.AudioManager; public class Main { public static void setStreamVolume(Context context, int streamType, int volume, int flag) { AudioManager audioManager = getAudioManager(context); if (audioManager == null) return; audioManager.setStreamVolume(streamType, volume, flag); } public static AudioManager getAudioManager(Context context) { return (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); } }