How do you undim the display programmatically?
I may compile upto 100 times a day. And most of the time the screen has dimmed and I must touch the screen to see clearly what change I just made. I do not need to change system brightness just locally. I’ve tried both of these variations to no avail, I still have to touch the screen to bring it to full brightness. Now maybe if I attached a 5 lb weight to my arm there would be some benefit rather than the minor irritation of doing the same thing over and over.
Code Commented out was tried also:
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.dimAmount=1F;
//screenBrightness = 1F;
getWindow().setAttributes(layout);
setContentView(R.layout.main);
I see two approaches:
1.The easiest way is to prevent the screen from dimming by using the keepScreenOn attribute. You can set it as a View attribute in your XML, but it is possible programmatically as well (setKeepScreenOn).
For example, programmatically, you can add this to your Activity’s onCreate() method:
2.If you want to deal with dimming/brightness, you can try to set layout.screenBrightness as well. If this approach does not work, it might be because the WindowManager does not know about it (i.e. no refresh happens). There is an accepted stackoverflow answer about it here, I never tested it though.