private void setBrightness(int brightness){
Log.i(this, "setBrightness"+ brightness);
Settings.System.putInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS,brightness);
Log.i(this, "getBrightness"+ brightness);
return ;
}
private int getBrightness(){
int brightness = 0 ;
try{
brightness = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
}catch(SettingNotFoundException ex){
Log.i(this, "getBrightness Exception");
}
Log.i(this, "getBrightness"+ brightness);
return brightness;
}
private void setBrightnessMode(int mode){
Log.i(this, "setBrightnessMode"+ mode);
Settings.System.putInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,mode);
}
private int getBrightnessMode(){
int automatic;
try{
automatic = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE);
}catch(SettingNotFoundException notfound){
automatic = 0;
}
return automatic;
}
设置屏幕亮度的办法
最新推荐文章于 2024-05-05 23:10:55 发布