title: getActivity().getActionBar() on first fragment crash
body: <pre><code>public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          setupViewPager();
  
      }
  
      private void setupViewPager() {
          // TODO Auto-generated method stub
          FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
                  getSupportFragmentManager(), FragmentPagerItems.with(this)
                          .add("Home", HomeFragment.class)
                          .add("Message", MessageFragment.class)
                          .add("My", MyFragment.class).create());
  
          ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
          viewPager.setAdapter(adapter);
          SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
          final LayoutInflater inflater = LayoutInflater.from(viewPagerTab.getContext());
          final Resources res = viewPagerTab.getContext().getResources();
          viewPagerTab.setCustomTabView(new SmartTabLayout.TabProvider() {
              @Override
              public View createTabView(ViewGroup container, int position,PagerAdapter adapter) {
                  ImageView icon = (ImageView) inflater.inflate(R.layout.mainactivity_tab, container, false);
                  switch (position) {
                  case 0:
                      icon.setImageDrawable(res.getDrawable(R.drawable.mainactivity_tab_icon_home));
                      break;
                  case 1:
                      icon.setImageDrawable(res.getDrawable(R.drawable.mainactivity_tab_icon_message));
                      break;
                  case 2:
                      icon.setImageDrawable(res.getDrawable(R.drawable.mainactivity_tab_icon_my));
                      break;
                  default:
                      throw new IllegalStateException("Invalid position: "+ position);
                  }
                  return icon;
              }
          });
          viewPagerTab.setViewPager(viewPager);
  
      }
  </code></pre>
  
  <p>Here is the code in that three fragment</p>
  
  <pre><code>public class HomeFragment extends Fragment {
      View rootView;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          rootView = inflater.inflate(R.layout.fragment_home, container, false);
  
          TextView title = (TextView) rootView.findViewById(R.id.item_title);
          title.setText("Home");
  
          return rootView;
      }
  
      @Override
      public void setMenuVisibility(final boolean visible) {
          super.setMenuVisibility(visible);
          if (visible) {
              Log.d("Action bar", "Home");
  
              ActionBar mActionBar= getActivity().getActionBar();
              mActionBar.setDisplayShowHomeEnabled(true);
              mActionBar.setDisplayShowTitleEnabled(false);
  
              LayoutInflater mInflater = LayoutInflater.from(getActivity());
              View mCustomView = mInflater.inflate(R.layout.actionbar_message, null);
              mActionBar.setCustomView(mCustomView);
              mActionBar.setDisplayShowCustomEnabled(true);
              TextView title = (TextView) mCustomView.findViewById(R.id.actionbar_message_title);
  
              title.setText("Home action bar");
          }
      }
  </code></pre>
  
  <p>They work on MessageFragment.class and MyFragment but not HomeFragment.
  It will crash and <code>ActionBar mActionBar = getActivity().getActionBar();</code> will return <code>null</code> and crash.</p>
  
  <p>Why it only works on MessageFragment and MyFragment?</p>
  
  <p>HomeFragment is the first fragment to show.</p>
  
  <p>My idea: I will to use different custom action bar on different fragment.</p>