Android - hiding ActionBar icon and title during launch

I was developing an app that had a tabbed interface (FragmentPagerAdapter) inside the main activity. Each tab was setting different ActionBar icon and title inside onTabSelected method. Something like this:

public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
   if (tab.getPosition() == 0){
   if (tab.getPosition() == 1) {
   if (tab.getPosition() == 2) {

This was working fine when the app was running and resuming from paused. But on the initial launch, global application icon and title was appearing inside ActionBar for half a second or so, before being overridden by the code in onTabSelected .


Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait