这是不弹出界面的方式:
/**
* @param value
* 0 - 15
*/
public void dealCMDSound(int value) {
AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (value >= 0
&& value <= mAudioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC)) {
System.out.println("--- sound: " + value);
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, value, 0);
return;
} else {
Log.e(TAG, "--- illegal sound value: " + value + ",ignored! ---");
}
}
标签:sound,code,STREAM,AudioManager,value,---,音量,android,mAudioManager From: https://blog.51cto.com/u_13316945/5832023