我正在尝试更改手机上的亮度模式和值,并在 SO 找到了一个很棒的线程,我认为它回答了我的问题,但在我的 froyo Dell Streak 上,此代码根本没有任何作用。putInt() 正在返回 true,因此所有帐户似乎都成功了,但亮度保持不变,甚至无法在手动和自动之间切换……我设置了 WRITE_SETTINGS 权限和 logcat似乎没有任何其他相关输出出现....现在被难住了,要休息一会儿o_0
这是我如何称呼它的片段,这是在我的(唯一)活动中:
public void onCheckedChanged(RadioGroup group, int checked) {
//BrightSettings bright = new BrightSettings();
switch(checked)
{
case R.id.daybutton:
//bright.setBrightMode(BrightSettings.DAY_MODE);
if(Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC))
Log.d("NightMode", "Brightness seems to be set to auto....");
case R.id.nightbutton:
//bright.setBrightMode(BrightSettings.NIGHT_MODE);
if (Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) && Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 2) )
Log.d("NightMode", "Night mode seems to have been set....");
}
}