How to keep your screen-on through XML in android?

By | September 3, 2011

Hello everyone,

Today I will give you a simple tip on how to keep your screen on While your application is running in android.
In Real devices the problem is you will loose some of the values in your variable when your device goes to sleep mode.
To prevent this what we can do is to prevent the phone from going to sleep mode.
To do this a simple thing needs to be done in your xml.

paste this in the root of your layout to keep the screen on.

android:keepScreenOn=”true”

Its really simple as that.

Leave a Reply

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