概述
try {
IPowerManager power = IPowerManager.Stub.asInterface(
ServiceManager.getService("power"));
if (power != null) {
power.setBacklightBrightness(brightness);
}
} catch (RemoteException doe) {
}
import android.provider.Settings.SettingNotFoundException;
import android.provider.Settings;
import android.os.IPowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 10;
private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
try {
mOldBrightness = Settings.System.getInt(getContext().getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException snfe) {
mOldBrightness = MAXIMUM_BACKLIGHT;
}
mSeekBar.setProgress(mOldBrightness - MINIMUM_BACKLIGHT);
private void setBrightness() {
int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
int mOldBrightness=0;
try {
mOldBrightness = Settings.System.getInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
Log.i("setBacklightBrightness", "onTouchEvent()->" + "ACTION_UPsetBacklightBrightness "+mOldBrightness);
} catch (SettingNotFoundException snfe) {
mOldBrightness = MAXIMUM_BACKLIGHT;
}
//mSeekBar.setProgress(mOldBrightness - MINIMUM_BACKLIGHT);
try {
IHardwareService hardware = IHardwareService.Stub.asInterface(
ServiceManager.getService("hardware"));
if (hardware != null) {
hardware.setBacklight(LIGHT_ID_BACKLIGHT,mOldBrightness);
}
} catch (RemoteException doe) {
}
}
最后
以上就是玩命店员为你收集整理的setBrightness的全部内容,希望文章能够帮你解决setBrightness所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复