我是靠谱客的博主 玩命店员,最近开发中收集的这篇文章主要介绍setBrightness,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部