I try to change brightness when dialog fragment opened,i insert this code on oncreate() but it change only for one second.
try {
curBrightnessValue = Settings.System.getInt(
getActivity().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
WindowManager.LayoutParams layout = getActivity().getWindow().getAttributes();
layout.screenBrightness = 1F;
getActivity().getWindow().setAttributes(layout);
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
In main fragment it works