DynamicIncludeGraphNavigator


@Navigator.Name(value = "include-dynamic")
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

The graph for dynamic-include.

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,
    NavOptions navOptions,
    Navigator.Extras navigatorExtras
)

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

void

Restore any state previously saved in onSaveState.

Bundle

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

Inherited methods

From androidx.navigation.Navigator
final @NonNull NavigatorState

The state of the Navigator is the communication conduit between the Navigator and the NavController that has called onAttach.

final boolean

Whether this Navigator is actively being used by a NavController.

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

Navigate to a destination.

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 constructors

DynamicIncludeGraphNavigator

Added in 2.3.0
public DynamicIncludeGraphNavigator(
    @NonNull Context context,
    @NonNull NavigatorProvider navigatorProvider,
    @NonNull NavInflater navInflater,
    @NonNull DynamicInstallManager installManager
)

Public methods

createDestination

Added in 2.3.0
public @NonNull 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.

public void navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    NavOptions navOptions,
    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

NavOptions navOptions

additional options for navigation

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

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

public Bundle onSaveState()

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