set Music Max Volume - Android Media

Android examples for Media:Media Volume

Description

set Music Max Volume

Demo Code


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

public class Main {
    public static void setMusicMax(Context mContext) {
        AudioManager audioManager = (AudioManager) mContext
                .getSystemService(Context.AUDIO_SERVICE);
        int max = audioManager
                .getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, max,
                AudioManager.FLAG_VIBRATE);
    }/*w w w  .j ava 2s  .co  m*/
}

Related Tutorials