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:Main.java

public static void justPop(FragmentActivity activity) {
    if (activity != null && activity.getSupportFragmentManager() != null) {
        final int count = activity.getSupportFragmentManager().getBackStackEntryCount();
        if (count > 0) {
            activity.getSupportFragmentManager().popBackStack();
        }/*from  w  w w . j  av a 2 s  . c  om*/
    }
}

From source file:Main.java

public static void setupView(int rl, Fragment mainFragment, FragmentActivity fragmentActivity) {
    FragmentTransaction transaction = fragmentActivity.getSupportFragmentManager().beginTransaction();
    transaction.replace(rl, mainFragment);
    transaction.show(mainFragment);//  w  w  w .  ja v  a 2 s. c  o  m
    //transaction.addToBackStack(null);
    transaction.commit();
}

From source file:Main.java

public static void loadFragment(FragmentActivity fragmentActivity, Fragment fragment, int fragmentContainerID) {
    fragmentActivity.getSupportFragmentManager().beginTransaction().add(fragmentContainerID, fragment).commit();
    fragmentActivity.getSupportFragmentManager().executePendingTransactions();
}

From source file:pl.mg6.newmaps.demo.util.GoogleMapHelper.java

public static GoogleMap getMap(FragmentActivity activity, int id) {
    FragmentManager fm = activity.getSupportFragmentManager();
    SupportMapFragment f = (SupportMapFragment) fm.findFragmentById(id);
    return f.getMap();
}

From source file:Main.java

/**
 * Replaces fragment without adding it to the back stack .
 */// w  w w  .j a v a 2  s.  c  o  m
public static void replaceFragment(FragmentActivity activity, Fragment fragment, int containerId) {
    FragmentManager manager = activity.getSupportFragmentManager();
    manager.beginTransaction().replace(containerId, fragment).commitAllowingStateLoss();
}

From source file:it.codingjam.lifecyclebinder.LifeCycleBinder.java

public static void bind(FragmentActivity activity) {
    bind(activity, activity.getSupportFragmentManager());
}

From source file:cheng.app.cnbeta.util.HelpUtils.java

public static void showAbout(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_about");
    if (prev != null) {
        ft.remove(prev);/*from  w ww.j a v  a  2s .  c  o m*/
    }
    ft.addToBackStack(null);
    new AboutFragment().show(ft, "dialog_about");
}

From source file:cheng.app.cnbeta.util.HelpUtils.java

public static void showOpenSourceLicenses(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_licenses");
    if (prev != null) {
        ft.remove(prev);//from  w  ww .  j av  a2  s . c om
    }
    ft.addToBackStack(null);

    new OpenSourceLicensesFragment().show(ft, "dialog_licenses");
}

From source file:Main.java

public static void remplaceFragment(FragmentActivity activity, Fragment newFragment, int fragmentId) {
    FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
    transaction.replace(fragmentId, newFragment);
    transaction.addToBackStack(null);/*from   w w w . java  2 s . c o  m*/
    transaction.commit();
}

From source file:Main.java

public static void removeFragment(Fragment fragment, FragmentActivity activity) {
    if (fragment != null) {
        FragmentTransaction fragTransaction = activity.getSupportFragmentManager().beginTransaction();
        fragTransaction.remove(fragment);
        fragTransaction.commit();//from  w w w  .  ja  v a 2  s. c om
    }
}