get Alarm Volume From Percentage - Android Android OS

Android examples for Android OS:Alarm Information

Description

get Alarm Volume From Percentage

Demo Code


//package com.java2s;

import android.media.AudioManager;

public class Main {
    public static int getAlarmVolumeFromPercentage(
            AudioManager audioManager, int audioStream, float percentage) {
        int volume = (int) Math.ceil((double) audioManager
                .getStreamMaxVolume(audioStream) * (percentage / 100.0d));
        return volume;
    }/*ww  w . ja  v a 2 s. c  o m*/
}

Related Tutorials