Code example for Handler: Scheduling a delayed task

Methods: postDelayed

0
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
 
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() { 
                WakeUp.this.finish();
            } 
        }, 200); 
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java