当前位置: 代码迷 >> Android >> Android开发片断–设置系统声音
  详细解决方案

Android开发片断–设置系统声音

热度:59   发布时间:2016-05-01 19:29:55.0
Android开发片段–设置系统声音

public static void setMaxVolumn(Context context){		AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);	    //audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM , 12, 0);		audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);	    Log.d("MUSIC", "max : " + 15 + " current : " + 15); 	}	public static void setHalfVolumn(Context context){		AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);		audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM , 7, 0);	    Log.d("MUSIC", "max : " + 15 + " current : " + 7); 	}	public static void setSilentVolumn(Context context){		AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);		//audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM , 2, 0);		audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);	    Log.d("MUSIC", "max : " + 15 + " current : " + 0); 	}
?
  相关解决方案