0

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+.

Cat
  • 66,919
  • 24
  • 133
  • 141
kolek
  • 3,690
  • 3
  • 24
  • 31
  • 1
    Take a look at this, http://stackoverflow.com/questions/4621490/android-2-2-adjusting-screen-brightness – Khoa Le Sep 19 '12 at 01:35

1 Answers1

2
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = <value from 0 to 1>;
getWindow().setAttributes(lp);
neevek
  • 11,760
  • 8
  • 55
  • 73
  • Thanks :) This is good solution, but more solid is Khoa Le answer, because there is how delete automatic bright problem. – kolek Sep 21 '12 at 19:18
  • 2
    Now i found this: http://stackoverflow.com/questions/5032588/cant-apply-system-screen-brightness-programmatically-in-android If You want save brightness even app is close, use this solution. – kolek Sep 21 '12 at 20:01