您如何在 Android 中获取/设置媒体音量(不是铃声音量)? [英] How do you get/set media volume (not ringtone volume) in Android?
本文介绍了您如何在 Android 中获取/设置媒体音量(不是铃声音量)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法获取/设置媒体音量?我尝试了以下方法:
Is there a way to get/set media volume? I have tried the following:
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int currentVolume = audio.getStreamVolume(AudioManager.STREAM_RING);
但它返回铃声音量.
推荐答案
你应该使用 AudioManager.STREAM_MUSIC
而不是 AudioManager.STREAM_RING
这个问题已经在这里讨论过.
Instead of AudioManager.STREAM_RING
you shoul use AudioManager.STREAM_MUSIC
This question has already discussed here.
这篇关于您如何在 Android 中获取/设置媒体音量(不是铃声音量)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文