List of usage examples for android.support.v4.app FragmentTransaction remove
public abstract FragmentTransaction remove(Fragment fragment);
From source file:Main.java
public static void removeFragment(Fragment fragment, FragmentManager fragmentManager) { FragmentTransaction ft = fragmentManager.beginTransaction(); ft.remove(fragment); ft.commit();/*from www . j a v a2 s . c o m*/ fragmentManager.popBackStack(); }
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 .java 2s . co m } }
From source file:Main.java
public static void popPreviousFragmentFromStack(FragmentManager fragmentManager, Stack<Fragment> fragmentStack) { FragmentTransaction ft = fragmentManager.beginTransaction(); fragmentStack.lastElement().onPause(); ft.remove(fragmentStack.pop()); fragmentStack.lastElement().onResume(); ft.show(fragmentStack.lastElement()); ft.commit();/*from w w w.j a v a 2s.c om*/ }
From source file:de.zell.android.util.fragments.FragmentReplacer.java
/** * Replaces the existing fragment on the given view with the new one. * If no fragment exists on the view the fragment is only placed. * The view is identified via the layout id. The backstack flag enables * fragment stacking./* w ww .j a v a 2 s . c om*/ * * @param fgrMgr the fragment manager which is used to replace the frag * @param frg the new fragment which should be placed * @param id the view which gets the new fragment * @param backstack the flag which enables the backstack */ public static void replace(FragmentManager fgrMgr, Fragment frg, int id, boolean backstack) { if (fgrMgr == null || frg == null || id <= 0) throw new IllegalArgumentException(); Fragment old = fgrMgr.findFragmentById(id); FragmentTransaction trx = fgrMgr.beginTransaction(); if (old != null) { trx.remove(old); } trx.replace(id, frg); if (backstack) trx.addToBackStack(null); trx.commit(); }
From source file:org.cvasilak.jboss.mobile.app.fragments.dialogs.ProgressDialogFragment.java
public static void dismissDialog(FragmentActivity activity) { ProgressDialogFragment dialog = (ProgressDialogFragment) activity.getSupportFragmentManager() .findFragmentByTag(TAG);/*from ww w . j a va 2 s.co m*/ if (dialog != null) { FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction(); ft.remove(dialog); ft.commitAllowingStateLoss(); } }
From source file:com.icloud.listenbook.unit.Helpers.java
public static void showAbout(AppCompatActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag("dialog_about"); if (prev != null) { ft.remove(prev); }//from www . ja v a 2 s.c o m ft.addToBackStack(null); }
From source file:org.droidparts.inner.delegate.SupportDelegate.java
public static void showDialogFragment(FragmentActivity activity, DialogFragment df) { FragmentManager fm = activity.getSupportFragmentManager(); String tag = df.getClass().getName(); FragmentTransaction ft = fm.beginTransaction(); Fragment f = fm.findFragmentByTag(tag); if (f != null) { ft.remove(f); }/*from w ww . j a v a 2 s . c om*/ df.show(ft, tag); }
From source file:org.droidparts.inner.fragments.SecretFragmentsSupportUtil.java
public static void dialogFragmentShowDialogFragment(FragmentActivity fragmentActivity, DialogFragment dialogFragment) { FragmentManager fm = fragmentActivity.getSupportFragmentManager(); String tag = dialogFragment.getClass().getName(); FragmentTransaction ft = fm.beginTransaction(); Fragment f = fm.findFragmentByTag(tag); if (f != null) { ft.remove(f); }//from w w w . j av a 2 s . c om dialogFragment.show(ft, tag); }
From source file:Main.java
public static void showDialog(@Nonnull DialogFragment dialogFragment, @Nonnull String fragmentTag, @Nonnull FragmentManager fm) {//from w ww.j av a 2s.c o m final FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(fragmentTag); if (prev != null) { ft.remove(prev); } // Create and show the dialog. dialogFragment.show(ft, fragmentTag); }
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); }/* w ww.j a v a2 s .com*/ ft.addToBackStack(null); new AboutFragment().show(ft, "dialog_about"); }