In my main activity, I would like to have it set up, so that I first get met by a contentView
just showing a background and some text. After X seconds, I want to change to my other view (GLSurfaceView
).
This is obviously something I am doing completely wrong.
This is how I've imagined it could've been done (it's all in the onCreate
method):
setContentView(R.layout.main);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
viewer = new Viewer(this);
setContentView(viewer);
Where layout Main
is what I want to show at the beginning and Viewer
is my GLSurfaceView
class.
What happens is that it just goes black for 10 seconds and then it starts loading the objects I've got that is shown through OpenGLES.
There's nothing wrong with the layout Main
, since it works if I just erase the lines under where the Thread.sleep
takes action. Though, nothing happens before the Thread.sleep
is over...
With that said, my questions are following:
contentView
not changing until after Thread.sleep
is done?I'm assuming this in your onCreate() and thats why you are seeing nothing.
The way I would implement this is to start a thread using AsyncTask sleep in the doInBackground and in the onPostExecute set up the new view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With