I have problems trying to set the screen brightness to the minimum. My code is the following:
WindowManager.LayoutParams params = w.getAttributes();
params.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;
w.setAttributes(params);
The problem is that the screen turns off completely in some devices and it is almost impossible to turn the screen on again even pressing the power button (fortunately the screen turns on again after a while). I have no idea about this behavior.
Help please. Thanks in advance.
Fran.
Try this,
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
And also check the Official Documentation Screen Brightness
try change the values with 0.1 precision in layout.screenBrightness = 0.1F
or 0.2F and so on.
I hope this helps your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With