I am trying to set the screen brightness but when I try and get the current window with this.getWindow() I get null. Why is this? I will post all of my code in my setBrightness() method.
System.putInt(getContentResolver(), System.SCREEN_BRIGHTNESS,
brightness);
Window window = getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.screenBrightness = brightness / (float) 255;
window.setAttributes(lp);