Android examples for Media:Audio
get Voice Current Percent
//package com.java2s; import android.content.Context; import android.media.AudioManager; public class Main { public static int getVoiceCurrentPercent(Context context) { AudioManager mAudioManager = (AudioManager) context .getSystemService(Context.AUDIO_SERVICE); float max = (float) mAudioManager .getStreamMaxVolume(AudioManager.STREAM_MUSIC); float current = (float) mAudioManager .getStreamVolume(AudioManager.STREAM_MUSIC); float percent = current / max * 100; return (int) percent; }/*from w ww .j ava 2 s .c o m*/ }