launchInContainer

fun <F : Fragment> launchInContainer(fragmentClass: Class<F>, fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = EmptyHiltActivity.DEFAULT_THEME, initialState: Lifecycle.State = Lifecycle.State.RESUMED): HiltFragmentScenario<F>

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty FragmentActivity themed by themeResId, and waits for it to reach initialState.

This method cannot be called from the main thread.

Parameters

fragmentClass

a fragment class to instantiate

fragmentArgs

a bundle to passed into fragment

themeResId

a style resource id to be set to the host activity's theme

initialState

The initial Lifecycle.State. Passing in DESTROYED will result in an IllegalArgumentException.


fun <F : Fragment, A : EmptyHiltActivity> launchInContainer(fragmentClass: Class<F>, activityClass: Class<A>, fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = EmptyHiltActivity.DEFAULT_THEME, initialState: Lifecycle.State = Lifecycle.State.RESUMED): HiltFragmentScenario<F>

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty EmptyHiltActivity themed by themeResId, and waits for it to reach initialState.

This method cannot be called from the main thread.

Parameters

fragmentClass

a fragment class to instantiate

activityClass

the activity that will host this fragment

fragmentArgs

a bundle to passed into fragment

themeResId

a style resource id to be set to the host activity's theme

initialState

The initial Lifecycle.State. Passing in DESTROYED will result in an IllegalArgumentException.