Here you can find the source of keepScreenOn(final Activity pActivity)
public static void keepScreenOn(final Activity pActivity)
//package com.java2s; import android.app.Activity; import android.view.WindowManager; public class Main { public static void keepScreenOn(final Activity pActivity) { pActivity.getWindow().addFlags(// w ww . ja v a 2s. c om WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } }