object(mysqli_result)#13 (5) {
["current_field"]=>
int(0)
["field_count"]=>
int(25)
["lengths"]=>
NULL
["num_rows"]=>
int(1)
["type"]=>
int(0)
}
手機設定 - 保存亮度 - 程序員論壇 - Powered by Discuz!
程序員論壇
標題: 手機設定 - 保存亮度 [打印本頁]
作者: GreenCup 時間: 2019-12-5 02:42
標題: 手機設定 - 保存亮度
Java Code Examples for android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS
保存亮度設置狀態- public static void saveBrightness(Activity activity, int brightness) {
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.System.canWrite(activity)) {
- Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS);
- intent.setData(Uri.parse("package:" + activity.getPackageName()));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- activity.startActivity(intent);
- }
- else {
- try{
- Uri uri = Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS);
- Settings.System.putInt(activity.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, brightness);
- // resolver.registerContentObserver(uri, true, myContentObserver);
- activity.getContentResolver().notifyChange(uri, null);
- }catch(Exception ex){
- ex.printStackTrace();
- }
- }
- }
複製代碼
歡迎光臨 程序員論壇 (http://program.thesmartfire.com/) |
Powered by Discuz! X2.5 |