Example usage for android.support.v4.app FragmentActivity getSupportFragmentManager

List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager

Introduction

In this page you can find the example usage for android.support.v4.app FragmentActivity getSupportFragmentManager.

Prototype

public FragmentManager getSupportFragmentManager() 

Source Link

Document

Return the FragmentManager for interacting with fragments associated with this activity.

Usage

From source file:com.google.android.apps.santatracker.invites.AppInvitesFragment.java

public static AppInvitesFragment getInstance(FragmentActivity activity) {

    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();

    AppInvitesFragment result = null;/*from w  w  w  . j a  v a  2  s.com*/

    Fragment fragment = fm.findFragmentByTag(FRAGMENT_TAG);
    if (fragment == null) {
        result = new AppInvitesFragment();
        ft.add(result, FRAGMENT_TAG).disallowAddToBackStack().commit();
    } else {
        result = (AppInvitesFragment) fragment;
    }

    return result;
}

From source file:com.github.yuukis.businessmap.app.ContactsActionFragment.java

public static void showDialog(FragmentActivity activity, ContactsItem contact) {
    FragmentManager manager = activity.getSupportFragmentManager();
    newInstance(contact).show(manager, TAG);
}

From source file:com.sociablue.nanodegree_p1.utils.FragmentRouter.java

public static void replace(FragmentActivity activity, Fragment fragment, int container,
        boolean addToBackStack) {

    //get fragment transaction question
    FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
    // Add the fragment to the 'fragment_container' FrameLayout
    transaction.replace(container, fragment);
    //Save Transaction to back stack so hardware back button will undo change.
    if (addToBackStack) {
        transaction.addToBackStack(null);
    }/*from w  ww  .  jav  a  2s  . co m*/
    //commit fragment change.
    transaction.commit();
}

From source file:com.getchute.android.photopickerplus.util.FragmentUtil.java

public static void replaceContentWithSingleFragment(FragmentActivity activity, AccountModel account,
        String folderId, List<Integer> selectedItemPositions) {
    FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.gcFragments,
            FragmentSingle.newInstance(account, folderId, selectedItemPositions), TAG_FRAGMENT_FILES);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();//from  w  ww .  j av a2s .com

}

From source file:com.tomeokin.lspush.ui.navigator.Navigator.java

public static void moveTo(FragmentActivity base, Class<? extends Fragment> fragment, Bundle args) {
    moveTo(base, base.getSupportFragmentManager(), fragment, args, DEFAULT_LAYOUT_ID,
            DEFAULT_ADD_TO_BACK_STACK);/*  ww w .  jav  a 2  s  . co m*/
}

From source file:org.mariotaku.twidere.fragment.ProgressDialogFragment.java

public static ProgressDialogFragment show(final FragmentActivity activity, final String tag) {
    if (activity == null)
        return null;
    final ProgressDialogFragment f = new ProgressDialogFragment();
    f.show(activity.getSupportFragmentManager(), tag);
    return f;/*from  w ww  .  ja  v  a  2  s . c  o m*/
}

From source file:org.solovyev.android.messenger.accounts.NoInternetConnectionDialog.java

public static void show(@Nonnull FragmentActivity activity) {
    AndroidSherlockUtils.showDialog(new NoInternetConnectionDialog(), TAG,
            activity.getSupportFragmentManager());
}

From source file:org.kaaproject.kaa.demo.cityguide.util.FragmentUtils.java

public static void popBackStack(FragmentActivity activity) {
    if (activity == null) {
        Log.e(TAG, "Unable pop fragment. Invalid args.");
        return;/*from  w  w w .java 2s. c  o  m*/
    }

    FragmentManager fm = activity.getSupportFragmentManager();
    if (fm.getBackStackEntryCount() > 0) {
        fm.popBackStack();
    }
}

From source file:jahirfiquitiva.iconshowcase.dialogs.WallpaperDialog.java

public static void dismiss(final FragmentActivity context) {
    Fragment frag = context.getSupportFragmentManager().findFragmentByTag(TAG);
    if (frag != null)
        ((WallpaperDialog) frag).dismiss();
}

From source file:org.droidparts.inner.reader.SupportFragmentReader.java

static Object readVal(Object fragmentActivityObj, int fragmentId, String valName) {
    FragmentActivity fragmentActivity = (FragmentActivity) fragmentActivityObj;
    if (fragmentId == 0) {
        fragmentId = ResourceUtils.getResourceId(fragmentActivity, valName);
    }/*from w w w  . j  av  a  2 s . c  o m*/
    return fragmentActivity.getSupportFragmentManager().findFragmentById(fragmentId);
}