android:keepScreenOn - Keep Screen Always One while TextView/EditText is Visible

How to Keep Screen Always On while TextView/EditText is Visible

android:keepScreenOn was added in API Level 1

Controls whether the view's window should keep the screen on while visible.
** Use android:keepScreenOn instead of PowerManager.WakeLock

1. Add a TextView in your main.xml file.

2. In the main.xml file, add the code below.

  <TextView
        ...
       android:keepScreenOn = "true"
  />

3. Ensure android:visibility in the TextView is NOT set to "invisible", or the screen will not be kept on.

4. Compile and run!

Related Articles:

Resources:
http://developer.android.com/reference/android/view/View.html#attr_android:keepScreenOn
http://developer.android.com/reference/android/R.attr.html#keepScreenOn
http://stackoverflow.com/questions/2131948/force-screen-on
http://stackoverflow.com/questions/5712849/how-do-i-keep-the-screen-on-in-my-app