Turn off/on android screen
问题 I am trying to turn the android screen off and then on again, after a few seconds. The "turn off" part works, with this code: WindowManager.LayoutParams layoutParam = getWindow().getAttributes(); oldBrightness = android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS)/255f; layoutParam.screenBrightness = 0; layoutParam.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; getWindow().setAttributes(layoutParam); But then, when I try