Code example for FragmentActivity

Methods: getWindow

0
	boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
	return (xlarge || large);
    } 
 
    public void setBrightness(float f) {
	WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
	layoutParams.screenBrightness = f;
	getWindow().setAttributes(layoutParams);
    } 
 
    public float getCurrentBrightness() { 
	WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
 
	return layoutParams.screenBrightness;
    } 
 
    public void setVolume(int value) {
	AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
	value = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) * value / 100;
 
	audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, value, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);