FragmentScenario.Companion

object FragmentScenario.Companion


Summary

Public methods

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using the given FragmentFactory and waits for it to reach the resumed state.

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach the resumed state.

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    Lifecycle.State initialState,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach initialState.

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    FragmentFactory factory
)

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

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    FragmentFactory factory
)

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, using the given FragmentFactory and waits for it to reach the resumed state.

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    Lifecycle.State initialState,
    FragmentFactory factory
)

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, using the given FragmentFactory and waits for it to reach initialState.

Public methods

launch

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using the given FragmentFactory and waits for it to reach the resumed state.

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

FragmentFactory factory

a fragment factory to use or null to use default factory

launch

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach the resumed state.

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

FragmentFactory factory

a fragment factory to use or null to use default factory

launch

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launch(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    Lifecycle.State initialState,
    FragmentFactory factory
)

Launches a Fragment with given arguments hosted by an empty FragmentActivity themed by themeResId, using the given FragmentFactory and waits for it to reach initialState.

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

Lifecycle.State initialState

The initial Lifecycle.State. This must be one of CREATED, STARTED, and RESUMED.

FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    FragmentFactory factory
)

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

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    FragmentFactory factory
)

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, using the given FragmentFactory and waits for it to reach the resumed state.

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

public final @NonNull FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    Class<F> fragmentClass,
    Bundle fragmentArgs,
    @StyleRes int themeResId,
    Lifecycle.State initialState,
    FragmentFactory factory
)

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, using the given FragmentFactory and waits for it to reach initialState.

This method cannot be called from the main thread.

Parameters
Class<F> fragmentClass

a fragment class to instantiate

Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

Lifecycle.State initialState

The initial Lifecycle.State. This must be one of CREATED, STARTED, and RESUMED.

FragmentFactory factory

a fragment factory to use or null to use default factory