I have a MainActivity
. Sometimes when it is loading I observe black screen for a second.
I measured timings for operations in onCreate
method and discovered that more than one second was spent for setContentView(R.layout.main_screen);
I prefer to show previous screen (in my case Splash screen) instead of this black screen during setContentView
execution. How can I rid off this black screen?
Seems android in some way preloads layouts and such problems occurs sometimes. But if I kill my process and start app I always see this black screen.
View
cache.AsyncTask
to don't freeze your originActivity
LayoutInflater
to inflate theView
layout and cache itonCreate()
of the target Activity set the cacheSomething like this:
Origin activity
Target activity
You can use also a ProgressDialog while inflating to avoid freeze sensation on the transition.