Android 各种音量的获取和设置.doc

上传人:11****ws 文档编号:2989860 上传时间:2019-05-16 格式:DOC 页数:2 大小:24.50KB
下载 相关 举报
Android 各种音量的获取和设置.doc_第1页
第1页 / 共2页
Android 各种音量的获取和设置.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

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)里的音量的范?是多少?

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 实用文档资料库 > 策划方案

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。