else if(code == KeyEvent.KEYCODE_LIGHT_DOWN){
System.out.println("the key is light-down"); try{
mOldBrightness = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
}catch(SettingNotFoundException snfe) {
mOldBrightness = 30;
} try{
IPowerManager power = IPowerManager.Stub.asInterface(
ServiceManager.getService("power")); if(power != null){
power.setBacklightBrightness(mOldBrightness - 10);
} }catch(RemoteException doe) { } if((mOldBrightness - 10) >= 30)
Settings.System.putInt(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, mOldBrightness - 10);
else
Settings.System.putInt(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, 30); }
本来是想将背光亮度每按一次减10 的,可是按键在 按下和弹起时 都操作了,按一次减了20, 求大神解决, 最好贴源码 java 不是很懂 ...急急急...
System.out.println("the key is light-down"); try{
mOldBrightness = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
}catch(SettingNotFoundException snfe) {
mOldBrightness = 30;
} try{
IPowerManager power = IPowerManager.Stub.asInterface(
ServiceManager.getService("power")); if(power != null){
power.setBacklightBrightness(mOldBrightness - 10);
} }catch(RemoteException doe) { } if((mOldBrightness - 10) >= 30)
Settings.System.putInt(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, mOldBrightness - 10);
else
Settings.System.putInt(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, 30); }
本来是想将背光亮度每按一次减10 的,可是按键在 按下和弹起时 都操作了,按一次减了20, 求大神解决, 最好贴源码 java 不是很懂 ...急急急...
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货