List of usage examples for android.support.v4.app FragmentManager beginTransaction
public abstract FragmentTransaction beginTransaction();
From source file:Main.java
public static void addFragment(FragmentManager manager, @IdRes int layout, Fragment fragment, int transitionStyle) { FragmentTransaction fragmentTransaction = manager.beginTransaction(); fragmentTransaction.add(layout, fragment, fragment.getClass().getSimpleName()); fragmentTransaction.setTransition(transitionStyle); //fragmentTransaction.addToBackStack(fragment.getClass().getSimpleName()); fragmentTransaction.addToBackStack(fragment.getClass().getSimpleName()); fragmentTransaction.commit();//from www . j a v a2 s . c o m manager.executePendingTransactions(); }
From source file:Main.java
public static void changeFragment(FragmentManager manager, @IdRes int layout, Fragment fragment, int transitionStyle) { FragmentTransaction fragmentTransaction = manager.beginTransaction(); fragmentTransaction.replace(layout, fragment, fragment.getClass().getSimpleName()); fragmentTransaction.setTransition(transitionStyle); fragmentTransaction.addToBackStack(fragment.getClass().getSimpleName()); fragmentTransaction.commit();// w w w .ja v a 2s. c om manager.executePendingTransactions(); }
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}. *//*from www . j av a 2 s. c om*/ public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, String tag, @NonNull Fragment fragment, int frameId) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(frameId, fragment, tag); transaction.commitAllowingStateLoss(); }
From source file:Main.java
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, int frameId, @NonNull Fragment fragment, String tag) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(frameId, fragment, tag); transaction.commit();/*from ww w. j a v a 2s . c o m*/ }
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}. * *//*from w ww. j av a 2s. c om*/ public static void addFragmentToActivity(int containerViewId, @NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, String tag) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(containerViewId, fragment, tag); transaction.commit(); }
From source file:com.dm.material.dashboard.candybar.fragments.dialog.WallpaperSettingsFragment.java
public static void showWallpaperSettings(FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev);//from www . j a va 2 s . com } try { DialogFragment dialog = WallpaperSettingsFragment.newInstance(); dialog.show(ft, TAG); } catch (IllegalArgumentException | IllegalStateException ignored) { } }
From source file:cn.upfinder.upfinder.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 av 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.androidinahurry.utils.DialogUtils.java
public static void showAboutDialog(FragmentActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag("about_dialog"); if (prev != null) { ft.remove(prev);/*from w w w. j a va 2 s .co m*/ } ft.addToBackStack(null); new HtmlDialogFragment().show(ft, "dialog_licenses"); }
From source file:Main.java
public static void replaceFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId, String tag) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(frameId, fragment, tag); transaction.commit();//w w w . j a va 2 s .com }
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}. * */// w w w . j av a 2 s . c om public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(frameId, fragment); transaction.commit(); }