Android examples for Phone:Screen
set Screen Brightness Mode
//package com.java2s; import android.content.Context; import android.provider.Settings; public class Main { public static boolean setScreenBrightnessMode(Context context, boolean auto) { boolean result = true; if (isScreenBrightnessModeAuto(context) != auto) { result = Settings.System .putInt(context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, auto ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); }/*from ww w. j a v a 2 s. co m*/ return result; } public static boolean isScreenBrightnessModeAuto(Context context) { return getScreenBrightnessModeState(context) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC ? true : false; } public static int getScreenBrightnessModeState(Context context) { return Settings.System.getInt(context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); } }