Android question. Is there a link to a simple example of changing the screen brightness for an activ

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-30T02:57:12Z Indexed on 2010/05/30 3:02 UTC
Read the original article Hit count: 330

Filed under:
|
|
|
|

There are apparently at least three different techniques for changing screen brightness in the Android OS. Two of them no longer work post-cupcake and the third accepted technique evidently has a bug.

I would like to increase screen brightness at the start of a one-view activity then turn the brightness back to the user setting at the end of the activity. No buttons, no second view or second activity. Just a maxed brightness at start and a return to original brightness setting at the end of the activity.

The examples of the current technique using WindowManager.LayoutParams that I have located range from 2 lines of code

WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 100 / 100.0f;
getWindow().setAttributes(lp);

to several pages of source code and numerous activities.

Is there a simple example of maxing the screen brightness at start that someone can provide a link to?

Thank you for reading my question.

© Stack Overflow or respective owner

Related posts about android

Related posts about screen