set Music Volume - Android Media

Android examples for Media:Media Volume

Description

set Music Volume

Demo Code


//package com.java2s;
import android.content.Context;
import android.media.AudioManager;

public class Main {
    public static void setMusic(Context mContext, int index) {
        AudioManager audioManager = (AudioManager) mContext
                .getSystemService(Context.AUDIO_SERVICE);
        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, index,
                AudioManager.FLAG_VIBRATE);
    }// www.java2 s .c o m
}

Related Tutorials