Returns maximum volume the media volume can have - Android Media

Android examples for Media:Media Volume

Description

Returns maximum volume the media volume can have

Demo Code


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

public class Main {
    /** Returns maximum volume the media volume can have
     * /*from w  w  w.j a va 2 s .c  o m*/
     * @param context Context
     * @return Maximum volume
     */
    public static int getMaximumVolume(Context context) {
        return ((AudioManager) context
                .getSystemService(Context.AUDIO_SERVICE))
                .getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    }
}

Related Tutorials