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 is what I’ve tried (this code is in the onCreate method)
setContentView(R.layout.layout_name);
try {
Thread.sleep(3000);
} catch ...
...
}
startVideo();
The problem is that calling Thread.sleep blacks the display and then the video starts.
How can I make the screen not go black?
You’re blocking the UIThread thats what is causing it to go blank…
Replace your
try {...}block with the following:And consider putting that in the
onStartoronResume…You should also read Processes and Threads to get an idea of what runs where and where you can block and where you cannot…