@Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    final Intent intent = getIntent();
    fixIntent(intent);

    setContentView(R.layout.dialtacts_activity);

    mContactListFilterController = ContactListFilterController.getInstance(this);
    mContactListFilterController.addListener(mContactListFilterListener);

    findViewById(R.id.dialtacts_frame).addOnLayoutChangeListener(mFirstLayoutListener);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(new ViewPagerAdapter(getFragmentManager()));
    mViewPager.setOnPageChangeListener(mPageChangeListener);

    // Setup the ActionBar tabs (the order matches the tab-index contants TAB_INDEX_*)
    setupDialer();
    setupCallLog();
    setupFavorites();
    getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayShowHomeEnabled(false);

    // Load the last manually loaded tab
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mLastManuallySelectedFragment =
        mPrefs.getInt(PREF_LAST_MANUALLY_SELECTED_TAB, PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT);
    if (mLastManuallySelectedFragment >= TAB_INDEX_COUNT) {
      // Stored value may have exceeded the number of current tabs. Reset it.
      mLastManuallySelectedFragment = PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT;
    }

    setCurrentTab(intent);

    if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction()) && icicle == null) {
      setupFilterText(intent);
    }
  }