Friday, February 4, 2011

Get system screen brightness

Last exercise describe how to "Change system screen brightness". If you want to get the current setting of system screen brightness, you can use the code:

        try {
curBrightnessValue=android.provider.Settings.System.getInt(
getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

4 comments:

  1. Hi, thanks for the blogging :)
    How can i change the wallpaper by code?

    ReplyDelete
  2. HI I try the code, but it always give me a value of 102 regardless which level of brightness I have adjusted. May I know why?

    ReplyDelete