Example usage for android.support.v4.app FragmentTransaction add

List of usage examples for android.support.v4.app FragmentTransaction add

Introduction

In this page you can find the example usage for android.support.v4.app FragmentTransaction add.

Prototype

public abstract FragmentTransaction add(int containerViewId, Fragment fragment);

Source Link

Document

Calls #add(int,Fragment,String) with a null tag.

Usage

From source file:abhishek.com.mvp.utils.ActivityUtils.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *//*from  w ww . j a v  a 2  s  .  c o m*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {

    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}

From source file:com.blueprint.helper.ActivityHelper.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *///from   w  ww  .j  ava  2 s.  c  o  m
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {
    CheckHelper.verifyObjects(fragmentManager, fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}

From source file:Main.java

public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {
    //        checkNotNull(fragmentManager);
    //        checkNotNull(fragment);
    if (fragmentManager != null && fragment != null) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.add(frameId, fragment);
        transaction.commit();/*from ww w . j  a v  a 2s.  co  m*/
    }

}

From source file:com.kevin.vlayouthelper.sample.utils.ActivityUtils.java

public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        String tag) {/*from  w w w  .  j  a v  a 2  s. c  om*/

    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(fragment, tag);
    transaction.commit();
}

From source file:com.example.joybar.myaskunagjia.demo.stucture.mvp.util.ActivityUtils.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *//*from w  w  w. ja  v  a 2 s  .  c  o  m*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {
    CheckUtils.checkNotNull(fragmentManager);
    CheckUtils.checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}

From source file:com.example.angelina.travelapp.util.ActivityUtils.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *///from  w  w w  . j  a v a  2s .c  o  m
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId, @NonNull String fragmentName) {
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.addToBackStack(fragmentName);
    transaction.commitAllowingStateLoss();
}

From source file:Main.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *///ww w . j a  va2 s.  co  m
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {
    checkNotNull(fragmentManager);
    checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}

From source file:ca.six.unittestapp.todo.util.ActivityUtils.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 */// www . ja  v a  2s  . c o m
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId) {
    checkNotNull(fragmentManager); //reason to use checkNotNull since calling this method may throw NullPointerException.
    checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}

From source file:Main.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *//* w  w  w.j  a v a  2s.  c  om*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId, @NonNull String fragmentName) {
    checkNotNull(fragmentManager);
    checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.addToBackStack(fragmentName);
    transaction.commit();
}

From source file:com.esri.android.ecologicalmarineunitexplorer.util.ActivityUtils.java

/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 *
 *//*w ww . ja v a2  s  .  c  om*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment,
        int frameId, @NonNull String fragmentName) {
    checkNotNull(fragmentManager);
    checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.addToBackStack(fragmentName); //don't need this if we're not adding more than one fragment
    transaction.commit();
}