I would like to dim-down my screen in my project as im working on.
I have an android phone that runs 2.2. It works great if I use the following code:
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 0;
getWindow().setAttributes(lp);
But when I tried the code on the emulator and on phone of my friend, that both runs 2.3, it goes to lock screen and i dont know why. Anyone who has an idea how I can dim the screen down for 2.3 devices?
Thanks!
Try this instead:
This is probably not the best way to fix this particular issue, but it works.