adjust Music Volume - Android Media

Android examples for Media:Media Volume

Description

adjust Music Volume

Demo Code


//package com.java2s;

import android.content.Context;

import android.media.AudioManager;

public class Main {

    public static void adjustMusicVolume(Context context, int volume) {
        AudioManager am = (AudioManager) context
                .getSystemService(Context.AUDIO_SERVICE);
        am.setStreamVolume(AudioManager.STREAM_MUSIC, volume,
                AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
    }/* w  ww .  j  a v a 2s. co  m*/
}

Related Tutorials