get Volume Level - Android Media

Android examples for Media:Media Volume

Description

get Volume Level

Demo Code


//package com.java2s;

import android.content.Context;

import android.media.AudioManager;

public class Main {
    private static AudioManager _audioManager;

    public static int getVolumeLevel(Context context) {

        if (_audioManager == null)
            _audioManager = (AudioManager) context
                    .getSystemService(Context.AUDIO_SERVICE);


        return (int) (_audioManager
                .getStreamVolume(AudioManager.STREAM_MUSIC) * 100 / 15);
    }//from   www.j a v a 2  s .co  m
}

Related Tutorials