Youssef El Hemaly
Youssef El Hemaly

Reputation: 51

How to re-enable screen dimming?

I needed to keep screen on while displaying my application so I disabled Dimming using this code : getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

the problem is that when I close the application, dimming is still disabled and I want to re-enable screen dimming for power saving is there a code to reverse it ?

note my application has services working in background all the time,I think it's irrelevant as I put the code in an activity class;

Upvotes: 1

Views: 82

Answers (1)

Ilya Gazman
Ilya Gazman

Reputation: 32221

You should use the View function setKeepScreenOn(). It's more friendly.

Upvotes: 1

Related Questions