Code example for TabHost

Methods: getCurrentTabTagsetCurrentTab

0
            return; 
        } 
 
        // Dismiss menu provided by any children activities 
        Activity activity = getLocalActivityManager().
                getActivity(mTabHost.getCurrentTabTag());
        if (activity != null) {
            activity.closeOptionsMenu();
        } 
 
        // Tell the children activities that they should ignore any possible saved 
        // state and instead reload their state from the parent's intent 
        intent.putExtra(EXTRA_IGNORE_STATE, true);
 
        // Choose the tab based on the inbound intent 
        String componentName = intent.getComponent().getClassName();
        if (getClass().getName().equals(componentName)) {
            if (recentCallsRequest) {
                mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG);
            } else { 
                mTabHost.setCurrentTab(TAB_INDEX_DIALER);
            } 
        } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
            mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
        } else { 
            SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE);
            boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS,
                    PREF_FAVORITES_AS_CONTACTS_DEFAULT);
            if (favoritesAsContacts) {
                mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
            } else { 
                mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
            } 
        } 
 
        // Tell the children activities that they should honor their saved states 
        // instead of the state from the parent's intent