NavHostKt

Added in 2.3.0

public final class NavHostKt


Summary

Public methods

static final @NonNull NavGraph
createGraph(
    @NonNull NavHost receiver,
    @IdRes int id,
    @IdRes int startDestination,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicNavGraphBuilderUnit> builder
)

This method is deprecated. Use routes to create your dynamic NavGraph instead

static final @NonNull NavGraph
createGraph(
    @NonNull NavHost receiver,
    @NonNull String startDestination,
    String route,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicNavGraphBuilderUnit> builder
)

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

Public methods

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

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.

@ExtensionFunctionType @NonNull Function1<@NonNull DynamicNavGraphBuilderUnit> 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,
    @ExtensionFunctionType @NonNull Function1<@NonNull DynamicNavGraphBuilderUnit> builder
)

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

Parameters
@NonNull KClass<@NonNull ?> startDestination

the starting destination's route from a KClass 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.

@ExtensionFunctionType @NonNull Function1<@NonNull DynamicNavGraphBuilderUnit> builder

the builder used to construct the graph