Keeping the Android screen on

Sometimes you prefer to keep the Android screen on also in case of prolonged inactivity, this limit is usually set at 30 seconds, beyond which the screen turns off to increase the battery life.
This can be true for applications like watching movies, navigators, or even during the development phase of an application.
To keep the screen on for a particular Activity you can use the following statement:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.