How Can I Control Contrast & Backlight Programmatically

Search This thread

unni_kmr

Senior Member
Dec 24, 2012
154
29
I need to develop an Android app which should have options to control LED brightness, backlight and contrast. From various documentation on internet, I found ways to control the brightness, but couldn't find anything about backlight and contrast. First of all, in Android devices, isn't brightness and backlight the same? Also, how can I control these two from code? Please let me know your suggestions.
 

Logopolis

New member
Feb 21, 2016
2
0
Brightness can be changed by setting the screenBrightness member of the window's LayoutParams (fetched with getAttributes()). It ranges from 0-1, or set to -1 to use the default brightness set by the user in display settings.

However, even at brightness level of 0, the backlight remains on; it's just dim.

I've been looking for a way to turn the backlight off completely, without success. I know it's possible because there is an app called "Screen Backllight OFF" that does it (device must be rooted). I've read various suggestions on using WakeLocks, but I want the device and my app to remain awake and active; all I want to do is temporarily turn off the backlight.

Does anyone know how to turn off the backlight?