FragmentTransactionKt

public final class FragmentTransactionKt


Summary

Public methods

static final @NonNull FragmentTransaction
<F extends Fragment> FragmentTransactionKt.add(
    FragmentTransaction receiver,
    @IdRes int containerViewId,
    String tag,
    Bundle args
)

Add a fragment to the associated FragmentManager, inflating the Fragment's view into the container view specified by containerViewId, to later retrieve via FragmentManager.findFragmentById.

static final @NonNull FragmentTransaction
<F extends Fragment> FragmentTransactionKt.add(
    FragmentTransaction receiver,
    String tag,
    Bundle args
)

Add a fragment to the associated FragmentManager without adding the Fragment to any container view.

static final @NonNull FragmentTransaction
<F extends Fragment> FragmentTransactionKt.replace(
    FragmentTransaction receiver,
    @IdRes int containerViewId,
    String tag,
    Bundle args
)

Replace an existing fragment that was added to a container.

Public methods

FragmentTransactionKt.add

public static final @NonNull FragmentTransaction <F extends Fragment> FragmentTransactionKt.add(
    FragmentTransaction receiver,
    @IdRes int containerViewId,
    String tag,
    Bundle args
)

Add a fragment to the associated FragmentManager, inflating the Fragment's view into the container view specified by containerViewId, to later retrieve via FragmentManager.findFragmentById.

The new fragment to be added will be created via the FragmentFactory of the FragmentManager.

Parameters
@IdRes int containerViewId

Identifier of the container this fragment is to be placed in.

String tag

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag.

Bundle args

Optional arguments to be set on the fragment.

Returns
@NonNull FragmentTransaction

Returns the same FragmentTransaction instance.

FragmentTransactionKt.add

public static final @NonNull FragmentTransaction <F extends Fragment> FragmentTransactionKt.add(
    FragmentTransaction receiver,
    String tag,
    Bundle args
)

Add a fragment to the associated FragmentManager without adding the Fragment to any container view.

The new fragment to be added will be created via the FragmentFactory of the FragmentManager.

Parameters
String tag

Tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag.

Bundle args

Optional arguments to be set on the fragment.

Returns
@NonNull FragmentTransaction

Returns the same FragmentTransaction instance.

FragmentTransactionKt.replace

public static final @NonNull FragmentTransaction <F extends Fragment> FragmentTransactionKt.replace(
    FragmentTransaction receiver,
    @IdRes int containerViewId,
    String tag,
    Bundle args
)

Replace an existing fragment that was added to a container. This is essentially the same as calling remove for all currently added fragments that were added with the same containerViewId and then add with the same arguments given here.

The new fragment to place in the container will be created via the FragmentFactory of the FragmentManager.

Parameters
@IdRes int containerViewId

Identifier of the container whose fragment(s) are to be replaced.

String tag

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag.

Bundle args

Optional arguments to be set on the fragment.

Returns
@NonNull FragmentTransaction

Returns the same FragmentTransaction instance.