I need to implement splash screen in my honeycomb app. I use this code in activity's onCreate to show splash:
setContentView(R.layout.splash);
getActionBar().hide();
and this code to show main UI after sometime:
setContentView(R.layout.main);
getActionBar().show();
But before onCreate is called and splash appears, there is small amount of time when action bar shown.
How can I make action bar invisible?
I tried to apply theme to activity without action bar:
<item name="android:windowActionBar">false</item>
but in that case getActionBar() always returns null and I found no way to show it again.
Actually, you could simply set splash
Activity
withNoActionBar
and set your mainactivity
with action bar.Put your splash screen in a separate activity and use
startActivityForResult
from your main activity'sonCreate
method to display it. This works because, according to the docs:You should probably do this only if the argument to
onCreate
isnull
(indicating a fresh launch of your activity, as opposed to a restart due to a configuration change).Just add this in your styles.xml
you can use this :
getSupportActionBar().hide();
if it doesn't work try this one :if above doesn't work try like this :
in your directory = res/values/style.xml , open style.xml -> there is attribute
parent
change toparent="Theme.AppCompat.Light.DarkActionBar"
if all of it doesn't work too. i don't know anymore. but for me it works.
this may be handy
add this to your manifest
cheers
I had still error with null pointer and finally it helped when I called first getWindow().requestFeature() and then super.onCreate()