Skip to content Skip to sidebar Skip to footer

Preventing Thread.sleep From Blacking Out Screen

I want to insert a pause in my create after loading the layout before I start a video. The layout loads an image which I want to display for 3 seconds before I start a video. This

Solution 1:

You're blocking the UIThread thats what is causing it to go blank... Replace your try {...} block with the following:

new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            startVideo();
        }
    }, 3000);

And consider putting that in the onStart or onResume...

You should also read Processes and Threads to get an idea of what runs where and where you can block and where you cannot...

Post a Comment for "Preventing Thread.sleep From Blacking Out Screen"