Put your splash screen in a separate activity and use startActivityForResult
from your main activity's onCreate
method to display it. This works because, according to the docs:
As a special case, if you call startActivityForResult() with a requestCode >= 0 during the initial onCreate(Bundle savedInstanceState)/onResume() of your activity, then your window will not be displayed until a result is returned back from the started activity. This is to avoid visible flickering when redirecting to another activity.
You should probably do this only if the argument to onCreate
is null
(indicating a fresh launch of your activity, as opposed to a restart due to a configuration change).