关于Android获取系统音量值的文章在网上随便一搜就一大堆,我在此再整理只是为了更方便与学习,相当于做笔记吧。

                    AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);                    max = am.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);// 0                    current= am.getStreamVolume(AudioManager.STREAM_VOICE_CALL);                    Log.e("service", "通话音量值:" + max + "-" + current);                    max = am.getStreamMaxVolume(AudioManager.STREAM_SYSTEM);// 1                    current = am.getStreamVolume(AudioManager.STREAM_SYSTEM);                    Log.e("service", "系统音量值:" + max + "-" + current);                    max = am.getStreamMaxVolume(AudioManager.STREAM_RING);// 2                    current = am.getStreamVolume(AudioManager.STREAM_RING);                    Log.e("service", "系统铃声值:" + max + "-" + current);                    max = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);// 3                    current = am.getStreamVolume(AudioManager.STREAM_MUSIC);                    Log.e("service", "音乐音量值:" + max + "-" + current);                    max = am.getStreamMaxVolume(AudioManager.STREAM_ALARM);// 4                    current = am.getStreamVolume(AudioManager.STREAM_ALARM);                    Log.e("service", "闹铃音量值:" + max + "-" + current);                    max = am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);// 5                    current = am                            .getStreamVolume(AudioManager.STREAM_NOTIFICATION);                    Log.e("service", "提示声音音量值:" + max + "-" + current);                    // ------还可以通过动态设置音量值的大小,方法如下:                    // public void setStreamVolume(int streamType, int index,                    // int flags);                    // streamType以上几种模式中的一种,                    // index:设置音量的大小                    // flags:标志位,不太清楚做什么的。

更多相关文章

  1. Android模拟器分辨率介绍
  2. android style
  3. Android获取屏幕宽高、屏幕密度、手动计算view大小
  4. Android预定义样式
  5. Android中文API(142) —— Gravity
  6. 三、安卓UI学习(1)
  7. android Dialog大小修改
  8. Android系统配置数据库注释(settings.db)
  9. android style

随机推荐

  1. 详解MySQL多版本并发控制机制(MVCC)源码
  2. MySQL快速插入一亿测试数据
  3. MySQL8.0.18配置多主一从
  4. MySql批量插入时如何不重复插入数据
  5. SQL模糊查询报:ORA-00909:参数个数无效问
  6. MySQL中日期型单行函数代码详解
  7. 如何搭建 MySQL 高可用高性能集群
  8. 分析mysql中一条SQL查询语句是如何执行的
  9. MySQL 发生同步延迟时Seconds_Behind_Mas
  10. MySQL如何使用使用Xtrabackup进行备份和