在Android中(使用Java),我怎么可以设置铃声音量(到指定号码)? [英] In Android (using Java), how can I set the ring volume (to a specified number)?
问题描述
因此,在我的应用程序,我有一个搜索栏,允许用户设定铃声音量(0 - 100)。我似乎无法找到一种方法来设置铃声音量到指定号码。我通过 AudioManager 类看了,但它告诉我,要么设置为ringermode普通/静音/震动。这就是不会我想要的。我希望卷是一个 特定号码的。这里有一个例子就是我在寻找:
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.
}
这是可能的Android中?如果是这样,怎么样?你能不能给我,我怎么能做到这一点的例子吗?
Is this possible in Android? If so, how? Can you give me an example of how I can do this?
感谢您。
推荐答案
中查找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.
这篇关于在Android中(使用Java),我怎么可以设置铃声音量(到指定号码)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!