List of usage examples for android.support.v4.app FragmentTransaction commitAllowingStateLoss
public abstract int 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}. *///from w w w .ja v 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 showDialog(DialogFragment dialog, FragmentManager fragmentManager, String tag, boolean allowStateLoss) { if (allowStateLoss) { final FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(dialog, tag);//from w w w . j av a 2 s . com transaction.commitAllowingStateLoss(); } else { dialog.show(fragmentManager, tag); } }
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);// www . j av a2 s.c om if (dialog != null) { FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction(); ft.remove(dialog); ft.commitAllowingStateLoss(); } }
From source file:Main.java
public static void startFragment(FragmentManager fm, Fragment fragment, int resId) { Fragment mFragment = fm.findFragmentByTag(fragment.getClass().getName()); FragmentTransaction ft = fm.beginTransaction(); if (mFragment == null) { ft.add(resId, fragment, fragment.getClass().getName()); }// w ww . j a va2s . co m ft.show(fragment); ft.commitAllowingStateLoss(); }
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 2 s. co 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:com.dmitrymalkovich.android.githubanalytics.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 ww . j ava 2 s .c o 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.commitAllowingStateLoss(); }
From source file:com.dmitrymalkovich.android.githubanalytics.util.ActivityUtils.java
public static void replaceFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) { checkNotNull(fragmentManager);/* w ww . j av a 2 s . c o m*/ checkNotNull(fragment); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(frameId, fragment); transaction.commitAllowingStateLoss(); }
From source file:com.stolets.rxdiffutil.util.SupportActivityUtils.java
/** * The {@code fragment} is added to the container view with id {@code frameId}. The operation is * performed by the {@code fragmentManager}. * * @param fragmentManager {@link FragmentManager} associated with {@link android.support.v7.app.AppCompatActivity}. * @param fragment {@link Fragment} to add. * @param tag A string identifying the fragment. *///ww w. j a va 2 s . com @SuppressWarnings("WeakerAccess") public static void addSupportFragmentToActivity(@NonNull final FragmentManager fragmentManager, @NonNull final Fragment fragment, @NonNull final String tag) { checkNotNull(fragmentManager, "fragmentManager must not be null!"); checkNotNull(fragment, "fragment must not be null!"); checkNotNull(tag, "tag must not be null!"); checkArgument(!tag.isEmpty(), "tag string must not be empty!"); removeSupportFragment(fragmentManager, tag); final FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(fragment, tag); transaction.commitAllowingStateLoss(); }
From source file:com.pileproject.drive.util.fragment.ProgressDialogFragment.java
/** * Shows a progress dialog with given parameters. * The dialog is based on {@link DialogFragment}. * * @param manager a {@link FragmentManager} or its sub-class * @param title the dialog title/* w ww . j a va2 s.co m*/ * @param message the dialog message * @param tag the fragment tag */ public static void showDialog(FragmentManager manager, String title, String message, String tag) { ProgressDialogFragment f = newInstance(title, message); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(f, tag); transaction.commitAllowingStateLoss(); }
From source file:am.roadpolice.roadpolice.dialogs.DialogRateUs.java
private static void showDialog(final FragmentManager fragmentManager) { if (fragmentManager == null) return;/*from www. j ava2 s . c om*/ DialogRateUs dialog = (DialogRateUs) fragmentManager.findFragmentByTag("rate_us"); if (dialog == null) dialog = new DialogRateUs(); dialog.setCancelable(false); // Start showing progress dialog fragment. FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(dialog, "rate_us"); transaction.commitAllowingStateLoss(); }