在Android(使用Java)中,如何设置铃声音量(指定的数字)?
因此,在我的应用程序中,我有一个搜索栏,允许用户设置铃声音量(0 - 100)。我似乎找不到将铃声音量设置为指定数字的方法。我查看了 AudioManager 类,但它告诉我将 Ringermode 设置为正常/静音/振动。这不是我想要的。我希望音量是特定数字。这是我正在寻找的示例:
private void setRinger (int volume) // volume = 0 - 100
{
setRingVolume (volume); // Whenever a person gets a call/sms/warning/anything etc., it should be this volume.
}
Is this possible in Android?如果是这样,怎么办?你能给我举个例子来说明如何做到这一点吗?
谢谢。
So in my application, I have a seekbar that allows the user to set the ringer volume (0 - 100). I can't seem to find a way to set the ringer volume to a specified number. I looked through the AudioManager class but it tells me to either set ringermode to normal/silent/vibrate. That is NOT what I want. I want the volume to be a specific number. Here's an example of what I'm looking for:
private void setRinger (int volume) // volume = 0 - 100
{
setRingVolume (volume); // Whenever a person gets a call/sms/warning/anything etc., it should be this volume.
}
Is this possible in Android? If so, how? Can you give me an example of how I can do this?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查找 AudioManager(此处的文档)。它应该包含您需要的一切,包括 setVibrateSetting、setRingerMode、setStreamVolume。所有这些设置都是相互独立的。
Look up the AudioManager (documentation here). It should have everything you need, including
setVibrateSetting
,setRingerMode
,setStreamVolume
. All those settings are separate from each other.