Code example for FragmentActivity

Methods: getSupportFragmentManager

0
        String tag = tabSpec.getTag();
 
        // Check to see if we already have a fragment for this tab, probably 
        // from a previously saved state.  If so, deactivate it, because our 
        // initial state is that a tab isn't shown. 
        tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
        if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
            FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
            ft.detach(tabInfo.fragment);
            ft.commit();
            activity.getSupportFragmentManager().executePendingTransactions();
        } 
 
        tabHost.addTab(tabSpec);
    } 
 
    /** (non-Javadoc) 
     * @see android.widget.TabHost.OnTabChangeListener#onTabChanged(java.lang.String) 
     */ 
    public void onTabChanged(String tag) {
Contextual code suggestions in your IDE  Get Codota for Java