Reputation: 152
I'm writing an Android app that connects to a computer and acts as a mouse. I want the screen to remain awake only while the app is being used. I know I can use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
to keep the screen on during an activity, but is there a way to keep the screen on for all activities or would I have to use that line of code in every onCreate
method for each activity?
Upvotes: 0
Views: 85
Reputation: 8747
You would have to use that line within each activity.
Or you could use Fragments and set it once in the only activity and it will be applied to each fragment from then on.
Upvotes: 2