Code example for FragmentTransaction

Methods: attach

            // If not, instantiate and add it to the activity 
            mFragment = Fragment.instantiate(mActivity, mClass.getName());
            ft.add(, mFragment, mTag);
        } else { 
            // If it exists, simply attach it in order to show it 
	public void onTabUnselected(Tab tab, FragmentTransaction ft) {
		if (mFragment != null) {
            // Detach the fragment, because another one is being attached 
Stop searching for code, let great code find you!  Add Codota to your java IDE