Android screen brightness Max Value?
Asked Answered
H

5

9
    WindowManager.LayoutParams layout = getWindow().getAttributes();
    layout.screenBrightness = 1F;
    getWindow().setAttributes(layout);

I added this code to button onClick and it worked ! But is there a higher value since the screen didn't light MAX ??

However answered 15/8, 2012 at 22:7 Comment(0)
A
9

As stated in the documentation, no. Setting screenBrightness to 1 should adjust the brightness to full light.

Arnuad answered 15/8, 2012 at 22:17 Comment(1)
A nice way to use this is by using the constant BRIGHTNESS_OVERRIDE_FULL. Its value is 1.0fCioban
P
1

You should be able to set the value as 1L and it should go to max brightness as this is the max brightness

WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);

Will set it to max brightness..

Peppery answered 15/8, 2012 at 22:22 Comment(0)
C
0

You should disable screen dimming first before you set the brightness, or you may get a less than MAX brightness ! Try something like this before you set the brightness:

// disable screen dimming (note - this also requires setting in manifest file)
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
Cafard answered 15/8, 2013 at 21:19 Comment(0)
W
0

You Use this code

float SysBackLightValue = 255f;


android.provider.Settings.System.putInt(BatteryBoosterActivity.this.getContentResolver(),   android.provider.Settings.System.SCREEN_BRIGHTNESS,(int) SysBackLightValue);                                    
Window myWindow =BatteryBoosterActivity.this. getWindow();
WindowManager.LayoutParams winParams = myWindow.getAttributes();                                    winParams.screenBrightness = 255f;
myWindow.setAttributes(winParams);
Warfold answered 23/4, 2014 at 11:18 Comment(0)
P
0

A full example shows how to change brightness by coding, foreground, background. brightnessdemo

Permutation answered 22/9, 2014 at 13:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.