1、通过程序获取 android 系统手机的铃声和音量。同样,设置铃声和音量的方法也很简单!AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);/通话音量int max = am.getStreamMaxVolume( AudioManager.STREAM_VOICE_CALL );int current = am.getStreamVolume( AudioManager.STREAM_VOICE_CALL );Log.d(”VIOCE_CALL”, “max : ” + max + ” curren
2、t : ” + current);/系统音量max = mAudioManager.getStreamMaxVolume( AudioManager.STREAM_SYSTEM );current = mAudioManager.getStreamVolume( AudioManager.STREAM_SYSTEM );Log.d(”SYSTEM”, “max : ” + max + ” current : ” + current);/铃声音量max = mAudioManager.getStreamMaxVolume( AudioManager.STREAM_RING );current =
3、 mAudioManager.getStreamVolume( AudioManager.STREAM_RING );Log.d(”RING”, “max : ” + max + ” current : ” + current);/音乐音量max = mAudioManager.getStreamMaxVolume( AudioManager.STREAM_MUSIC );current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC );Log.d(”MUSIC”, “max : ” + max + ” current :
4、 ” + current);/提示声音音量max = am.getStreamMaxVolume( AudioManager.STREAM_ALARM );current = sm.getStreamVolume( AudioManager.STREAM_ALARM );Log.d(”ALARM”, “max : ” + max + ” current : ” + current);设置音量的方法也很简单,AudioManager 提供了方法:public void setStreamVolume(int streamType, int index, int flags)其中 streamType 有内置的常量,可以在 AudioManager 里面查到相关的定义。eoeAndroidsetVolume (leftVolume, rightVolume)里的音量的范?是多少?