Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KeepScreenOn extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_keepscreenon);
- }
- @Override
- protected void onResume() {
- super.onResume();
- this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- }
- @Override
- protected void onPause() {
- this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- super.onPause();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement