Reputation: 993
I have a splashscreen which downloads some files from my webserver.
After downloading I need to start the mainactivity
which has to create many buttons at runtime and this needs some time.
Is it possible to start the mainactivity
without showing it (so still show the splashscreen) and let the mainactivity its @onCreate()
and after it is finished then show the mainactivity?
I think changing setContentView
may not work because the buttons need the root layout of the mainactivity.
Upvotes: 0
Views: 332
Reputation: 331
Unfortunately, NO.
onCreate
only call when your activity start.
I suggest you to use only one activity with two fragments ( Splash fragment
and Main fragment
).
First, you start activity and show splash fragment. When splash fragment finish, you show the main fragment.
It's faster than 2 activity, I'm sure that.
Upvotes: 1