标签EXTRA_VOLUME_STREAM_TYPE是隐藏的,所以我使用了显式字符串“android.media.EXTRA_VOLUME_STREAM_TYPE”.这一切在Android 2.3.4上运行良好(按预期获得了volume_voice的值0),但在2.3.5上,此额外保存的值为10,这在Settings.System.VOLUME_SETTINGS上给出了一个ArrayIndexOutOfBoundsException.
此外,我在Settings.System.VOLUME_SETTINGS中看到volume_voice仍然是索引0.
有没有更健壮的方法来处理volume_voice流类型的VOLUME_CHANGED_ACTION?
编辑或任何其他方式来做标题要求的?
解决方法
I’m trying to register a broadcast receiver to handle the VOLUME_CHANGED_ACTION event
There is no VOLUME_CHANGED_ACTION
in the Android SDK.
The label EXTRA_VOLUME_STREAM_TYPE is hidden,so I have used the explicit string “android.media.EXTRA_VOLUME_STREAM_TYPE” instead.
Android SDK中没有EXTRA_VOLUME_STREAM_TYPE.
Is there a more robust way to handle VOLUME_CHANGED_ACTION for volume_voice stream types?
Android SDK中没有VOLUME_CHANGED_ACTION.
无论你想要做什么都没有文档,不受支持,可能不适用于任何给定版本的Android(过去/现在/未来),并且可能无法在任何给定设备上运行(因为制造商可以更改SDK中没有的任何内容).根据定义,它永远不会“强大”.