tags:

views:

57

answers:

1

I know this is possible as the built in clock app and other apps are able to do it.

How do you turn off the button backlights from code? These would be those like the softkeys on the bottom of the Nexus One screen.

Update:

Found this, but it only works on Froyo:

WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.buttonBrightness = 0;

Any other ideas?

A: 

Refer to this section of the Android documentation: http://developer.android.com/reference/android/os/PowerManager.html

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();
   //screen will stay on during this section...
wl.release();

By calling SCREEN_DIM_WAKE_LOCK you will set the screen to dim and the keyboard to off. Alternatively, you can call SCREEN_BRIGHT_WAKE_LOCK which sets the screen to bright and the keyboard to off or PARTIAL_WAKE_LOCK which turns both the screen and the keyboard off.

Ryan Berger
Tried that. It only seems to turn off the keyboard backlight, not the softkey backlights.
Jim Jenkins