FragmentManagerKt

public final class FragmentManagerKt


Summary

Public methods

static final void
FragmentManagerKt.commit(
    @NonNull FragmentManager receiver,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

Run body in a FragmentTransaction which is automatically committed if it completes without exception.

static final void
FragmentManagerKt.commitNow(
    @NonNull FragmentManager receiver,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

Run body in a FragmentTransaction which is automatically committed if it completes without exception.

static final void
FragmentManagerKt.transaction(
    @NonNull FragmentManager receiver,
    boolean now,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

This method is deprecated. Use commit { ..

Public methods

FragmentManagerKt.commit

@NonNull
public static final void FragmentManagerKt.commit(
    @NonNull FragmentManager receiver,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

Run body in a FragmentTransaction which is automatically committed if it completes without exception.

The transaction will be completed by calling FragmentTransaction.commit unless allowStateLoss is set to true in which case FragmentTransaction.commitAllowingStateLoss will be used.

FragmentManagerKt.commitNow

@NonNull
public static final void FragmentManagerKt.commitNow(
    @NonNull FragmentManager receiver,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

Run body in a FragmentTransaction which is automatically committed if it completes without exception.

The transaction will be completed by calling FragmentTransaction.commitNow unless allowStateLoss is set to true in which case FragmentTransaction.commitNowAllowingStateLoss will be used.

FragmentManagerKt.transaction

@NonNull
public static final void FragmentManagerKt.transaction(
    @NonNull FragmentManager receiver,
    boolean now,
    boolean allowStateLoss,
    @NonNull Function1<@NonNull FragmentTransactionUnit> body
)

Run body in a FragmentTransaction which is automatically committed if it completes without exception.

One of four commit functions will be used based on the values of now and allowStateLoss:

    |  now  |  allowStateLoss  | Method                         |
    | ----- | ---------------- | ------------------------------ |
    | false | false            |  commit()                      |
    | false | true             |  commitAllowingStateLoss()     |
    | true  | false            |  commitNow()                   |
    | true  | true             |  commitNowAllowingStateLoss()  |