DynamicIncludeGraphNavigator

public final class DynamicIncludeGraphNavigator extends Navigator


Navigator for include-dynamic.

Use it for navigating to NavGraphs contained within a dynamic feature module.

Summary

Nested types

DynamicIncludeGraphNavigator.DynamicIncludeNavGraph

The graph for dynamic-include.

Public fields

final boolean

Whether this Navigator is actively being used by a NavController.

Public constructors

DynamicIncludeGraphNavigator(
    @NonNull Context context,
    @NonNull NavigatorProvider navigatorProvider,
    @NonNull NavInflater navInflater,
    @NonNull DynamicInstallManager installManager
)

Public methods

@NonNull DynamicIncludeGraphNavigator.DynamicIncludeNavGraph

Construct a new NavDestination associated with this Navigator.

void
navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigates to a dynamically included graph from a com.android.dynamic-feature module.

void

Restore any state previously saved in onSaveState.

@Nullable Bundle

Called to ask for a Bundle representing the Navigator's state.

Inherited methods

From class Navigator
@Nullable NavDestination
navigate(
    @NonNull DynamicIncludeGraphNavigator.DynamicIncludeNavGraph destination,
    @Nullable Bundle args,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

@CallSuper void

Indicator that this Navigator is actively being used by a NavController.

void

Informational callback indicating that the given backStackEntry has been affected by a NavOptions.shouldLaunchSingleTop operation.

boolean

Attempt to pop this navigator's back stack, performing the appropriate navigation.

void
popBackStack(@NonNull NavBackStackEntry popUpTo, boolean savedState)

Attempt to pop this navigator's back stack, performing the appropriate navigation.

Public fields

isAttached

@NonNull
public final boolean isAttached

Whether this Navigator is actively being used by a NavController.

This is set to true when onAttach is called.

Public constructors

DynamicIncludeGraphNavigator

public final DynamicIncludeGraphNavigator(
    @NonNull Context context,
    @NonNull NavigatorProvider navigatorProvider,
    @NonNull NavInflater navInflater,
    @NonNull DynamicInstallManager installManager
)

Public methods

createDestination

@NonNull
public DynamicIncludeGraphNavigator.DynamicIncludeNavGraph createDestination()

Construct a new NavDestination associated with this Navigator.

Any initialization of the destination should be done in the destination's constructor as it is not guaranteed that every destination will be created through this method.

@NonNull
public void navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigates to a dynamically included graph from a com.android.dynamic-feature module.

Parameters
@NonNull List<@NonNull NavBackStackEntry> entries

destination(s) to navigate to

@Nullable NavOptions navOptions

additional options for navigation

@Nullable Navigator.Extras navigatorExtras

extras unique to your Navigator.

Throws
android.content.res.Resources.NotFoundException

if one of the entries does not have a valid graphResourceName and graphPackage.

kotlin.IllegalStateException

if one of the entries does not have a parent.

See also
navigate

onRestoreState

@NonNull
public void onRestoreState(@NonNull Bundle savedState)

Restore any state previously saved in onSaveState. This will be called before any calls to navigate or popBackStack.

Calls to createDestination should not be dependent on any state restored here as createDestination can be called before the state is restored.

Parameters
@NonNull Bundle savedState

The state previously saved

onSaveState

@Nullable
public Bundle onSaveState()

Called to ask for a Bundle representing the Navigator's state. This will be restored in onRestoreState.