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:

Erol said...

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

Erik said...

hello Erol,

please refer Set Wallpaper using WallpaperManager

Erol said...

Thank you so much.

nikkiyap17 said...

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?