在Android(使用Java)中,如何设置铃声音量(指定的数字)?

发布于 2024-10-04 17:59:57 字数 547 浏览 0 评论 0原文

因此,在我的应用程序中,我有一个搜索栏,允许用户设置铃声音量(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱*していゐ 2024-10-11 17:59:57

查找 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文