NavHostKt

Added in 2.4.0

public final class NavHostKt

Summary

Public methods

createGraph

public static final @NonNull NavGraph createGraph(
 @NonNull NavHost receiver,
 @IdRes int id,
 @IdRes int startDestination,
 @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)

Construct a new NavGraph

public static final @NonNull NavGraph createGraph(
 @NonNull NavHost receiver,
 @NonNull String startDestination,
 String route,
 @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)

Construct a new NavGraph

public static final @NonNull NavGraph createGraph(
 @NonNull NavHost receiver,
 @NonNull Object startDestination,
 KClass<@NonNull ?> route,
 @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
 @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)

Construct a new NavGraph

Parameters
@NonNull Object startDestination

the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added as a KClass in order to match.

KClass<@NonNull ?> route

the graph's unique route from a KClass

@NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap

A mapping of KType to custom NavType<*> in the route. May be empty if route does not use custom NavTypes.

@NonNull Function1<@NonNull NavGraphBuilder, Unit> builder

the builder used to construct the graph

public static final @NonNull NavGraph createGraph(
 @NonNull NavHost receiver,
 @NonNull KClass<@NonNull ?> startDestination,
 KClass<@NonNull ?> route,
 @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
 @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)

Construct a new NavGraph