FragmentScenario.Companion

object FragmentScenario.Companion


Summary

Public methods

final @NonNull FragmentScenario<@NonNull F>
<F extends Fragment> launch(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @Nullable 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(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable 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(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable 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(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @Nullable 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(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable 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(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable 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

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launch(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory

launch

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launch(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory

launch

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launch(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

@NonNull Lifecycle.State initialState

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

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory

launchInContainer

@NonNull
public final FragmentScenario<@NonNull F> <F extends Fragment> launchInContainer(
    @NonNull Class<@NonNull F> fragmentClass,
    @Nullable Bundle fragmentArgs,
    @StyleRes int themeResId,
    @NonNull Lifecycle.State initialState,
    @Nullable 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
@NonNull Class<@NonNull F> fragmentClass

a fragment class to instantiate

@Nullable Bundle fragmentArgs

a bundle to passed into fragment

@StyleRes int themeResId

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

@NonNull Lifecycle.State initialState

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

@Nullable FragmentFactory factory

a fragment factory to use or null to use default factory