Code example for AudioManager

Methods: getStreamMaxVolumegetStreamVolume

	private static float NO_VALUE = (float)-1.0;
	private static Float lastSystemVolume = NO_VALUE;
	public static void notifyVolumeChange() { 
		AudioManager aManager = (AudioManager) appContext.getSystemService(Context.AUDIO_SERVICE);
		Float maxVolume = Float.valueOf(aManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
		Float systemVolume = Float.valueOf(aManager.getStreamVolume(AudioManager.STREAM_MUSIC));
		// Only dispatch the event if the volume actually changed. 
		// The settings watcher is going to see *any* settings change, 
		// so it's possible that we'll get in here but the volume hasn't 
		// changed.  We shouldn't tell Flash if that's the case. 
		if (systemVolume != lastSystemVolume) {
			lastSystemVolume = systemVolume;
			Float flashVolume = systemVolume / maxVolume;
			Log.i(TAG, "system volume: " + systemVolume);
			Log.i(TAG, "adjusted volume: " + flashVolume);
Stop searching for code, let great code find you!  Add Codota to your java IDE