turn Off Music Volume - Android Media

Android examples for Media:Media Volume

Description

turn Off Music Volume

Demo Code


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

public class Main {
    public static int turnOffMusic(Context mContext) {
        AudioManager audioManager = (AudioManager) mContext
                .getSystemService(Context.AUDIO_SERVICE);
        int current = audioManager
                .getStreamVolume(AudioManager.STREAM_MUSIC);
        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0,
                AudioManager.FLAG_VIBRATE);
        return current;
    }/*from w w w.  ja v a  2  s.c om*/
}

Related Tutorials