adjust Volume - Android Media

Android examples for Media:Media Volume

Description

adjust Volume

Demo Code


//package com.java2s;

import android.content.Context;

import android.media.AudioManager;

public class Main {

    public static void adjustVolume(Context context, int volume) {
        AudioManager am = (AudioManager) context
                .getSystemService(Context.AUDIO_SERVICE);
        am.setStreamVolume(AudioManager.STREAM_SYSTEM, volume,
                AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
    }// www  . j av a2s. c  o  m
}

Related Tutorials