add

inline fun <F : Fragment> FragmentTransaction.add(@IdRes containerViewId: Int, tag: String? = null, args: Bundle? = null): FragmentTransaction

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.

Return

Returns the same FragmentTransaction instance.

Parameters

containerViewId

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

tag

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

args

Optional arguments to be set on the fragment.


inline fun <F : Fragment> FragmentTransaction.add(tag: String, args: Bundle? = null): FragmentTransaction

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.

Return

Returns the same FragmentTransaction instance.

Parameters

tag

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

args

Optional arguments to be set on the fragment.