Search in sources :

Example 11 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project UltimateAndroid by cymcsg.

the class BasicUtils method addFragmentToActivity.

/**
     * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
     * performed by the {@code fragmentManager}.
     */
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) {
    Preconditions.checkNotNull(fragmentManager);
    Preconditions.checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 12 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project android-betterpickers by code-troopers.

the class SampleNumberUsingFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frame_layout);
    Fragment fragment = new SampleNumberFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.frame, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) SampleNumberFragment(com.codetroopers.betterpickers.sample.fragment.SampleNumberFragment) SampleNumberFragment(com.codetroopers.betterpickers.sample.fragment.SampleNumberFragment) Fragment(android.support.v4.app.Fragment)

Example 13 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Android-PanesLibrary by cricklet.

the class PhoneDelegate method setMenuFragment.

@Override
public void setMenuFragment(Fragment f) {
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.menu_frame, f);
    ft.commit();
    wMenuFragment = new WeakReference<Fragment>(f);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment)

Example 14 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project Libraries-for-Android-Developers by eoecn.

the class ActionBarImpl method selectTab.

@Override
public void selectTab(Tab tab) {
    if (getNavigationMode() != NAVIGATION_MODE_TABS) {
        mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
        return;
    }
    FragmentTransaction trans = null;
    if (mActivity instanceof FragmentActivity) {
        trans = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
    }
    if (mSelectedTab == tab) {
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
            mTabScrollView.animateToTab(tab.getPosition());
        }
    } else {
        mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
        }
        mSelectedTab = (TabImpl) tab;
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
        }
    }
    if (trans != null && !trans.isEmpty()) {
        trans.commit();
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 15 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project SharedPreferenceInspector by PrashamTrivedi.

the class SharedPrefsBrowser method startFragment.

/**
	 * Start given Fragment
	 *
	 * @param fragment
	 * 		: Fragment Instance to start.
	 * @param tag
	 * 		: Tag to be notified when adding to backstack
	 * @param canAddToBackstack
	 * 		: pass <code>true</code> if you want to add this item in backstack. pass <code>false</code> otherwise
	 */
public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) {
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment);
    if (canAddToBackstack) {
        transaction.addToBackStack(tag);
    }
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Aggregations

FragmentTransaction (android.support.v4.app.FragmentTransaction)367 Fragment (android.support.v4.app.Fragment)132 FragmentManager (android.support.v4.app.FragmentManager)73 DialogFragment (android.support.v4.app.DialogFragment)26 FragmentActivity (android.support.v4.app.FragmentActivity)25 View (android.view.View)23 FragmentTransaction (android.app.FragmentTransaction)18 Intent (android.content.Intent)18 TextView (android.widget.TextView)18 Button (android.widget.Button)17 Bundle (android.os.Bundle)16 OnClickListener (android.view.View.OnClickListener)16 SherlockFragment (com.actionbarsherlock.app.SherlockFragment)12 TargetApi (android.annotation.TargetApi)6 ActionBar (android.support.v7.app.ActionBar)6 AppCompatActivity (android.support.v7.app.AppCompatActivity)6 Toolbar (android.support.v7.widget.Toolbar)6 FriendsTimeLineFragment (org.qii.weiciyuan.ui.maintimeline.FriendsTimeLineFragment)6 UserInfoFragment (org.qii.weiciyuan.ui.userinfo.UserInfoFragment)6 Transition (android.transition.Transition)5