I am using the method setKeepScreenOn(true) and haven\'t been able to figure out how to call this in relation to the current Activity (which has a content view set). I\'ve
According to Google Docs for android Developers you've two ways to do this :
First way :
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
Second way is to add in your xml file layout this attribute:
android:keepScreenOn="true"