Android examples for Media:Audio
Return the volume for music.
//package com.java2s; import android.content.Context; import android.media.AudioManager; import android.support.annotation.NonNull; public class Main { /** Return the volume for music. */ public static int getMusicVolume(@NonNull Context context) { return getAudioManager(context).getStreamVolume( AudioManager.STREAM_MUSIC); }/*ww w.jav a 2 s . co m*/ private static AudioManager getAudioManager(@NonNull Context context) { return (AudioManager) context.getApplicationContext() .getSystemService(Context.AUDIO_SERVICE); } }