How to change screen brightness?
-
02-07-2021 - |
Frage
How I can change screen brightness in Android?
I can find how to do this for application, but I want do it for all system and permanently (until user changes it in options).
I don't need to set it for custom value. Just low brightness level, Medium brightness and Maximum will be perfect.
It is possible for example with PowerManager
or something like that \?
Using Android 2.0+.
Lösung
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = <value from 0 to 1>;
getWindow().setAttributes(lp);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow