set Max Volume - Android Media

Android examples for Media:Media Volume

Description

set Max Volume

Demo Code


//package com.java2s;

import android.content.Context;

import android.media.AudioManager;

public class Main {

    public static void setMaxVolume(Context context) {
        AudioManager am = (AudioManager) context
                .getSystemService(Context.AUDIO_SERVICE);// ???
        int audioMaxVolum = am
                .getStreamMaxVolume(AudioManager.STREAM_SYSTEM);
        am.setStreamVolume(AudioManager.STREAM_SYSTEM, audioMaxVolum,
                AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);

    }//from w  ww. j a  v  a2s  .  c  om
}

Related Tutorials