Android examples for android.media:Volume
get Ringer Volume
import android.content.Context; import android.media.AudioManager; import android.support.annotation.NonNull; public class Main{ /** Return the volume for the ringer. */ public static int getRingerVolume(@NonNull Context context) { return getAudioManager(context).getStreamVolume( AudioManager.STREAM_RING); }/* www.j a v a 2 s .co m*/ private static AudioManager getAudioManager(@NonNull Context context) { return (AudioManager) context.getApplicationContext() .getSystemService(Context.AUDIO_SERVICE); } }