DynamicFragmentNavigator

@Navigator.Name(value = "fragment")
class DynamicFragmentNavigator : FragmentNavigator


The Navigator that enables navigating to destinations within dynamic feature modules.

Summary

Nested types

Destination for dynamic feature navigator.

Public constructors

DynamicFragmentNavigator(
    context: Context,
    manager: FragmentManager,
    containerId: Int,
    installManager: DynamicInstallManager
)

Public functions

open DynamicFragmentNavigator.Destination

Construct a new NavDestination associated with this Navigator.

open Unit
navigate(
    entries: List<NavBackStackEntry>,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
)

{@inheritDoc}

Inherited functions

From androidx.navigation.fragment.FragmentNavigator
open Fragment
instantiateFragment(
    context: Context,
    fragmentManager: FragmentManager,
    className: String,
    args: Bundle?
)

This function is deprecated. Set a custom {@link androidx.fragment.app.FragmentFactory} via {@link FragmentManager#setFragmentFactory(FragmentFactory)} to control instantiation of Fragments.

open Unit

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

open Unit

{@inheritDoc}

open Unit
onRestoreState(savedState: Bundle)

Restore any state previously saved in onSaveState.

open Bundle?

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

open Unit
popBackStack(popUpTo: NavBackStackEntry, savedState: Boolean)

{@inheritDoc}

From androidx.navigation.Navigator
open NavDestination?
navigate(
    destination: FragmentNavigator.Destination,
    args: Bundle?,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
)

Navigate to a destination.

open Boolean

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

Inherited properties

From androidx.navigation.Navigator
Boolean

Whether this Navigator is actively being used by a NavController.

NavigatorState

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

Public constructors

DynamicFragmentNavigator

Added in 2.3.0
DynamicFragmentNavigator(
    context: Context,
    manager: FragmentManager,
    containerId: Int,
    installManager: DynamicInstallManager
)

Public functions

createDestination

Added in 2.3.0
open fun createDestination(): DynamicFragmentNavigator.Destination

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.

Returns
DynamicFragmentNavigator.Destination

a new NavDestination

open fun navigate(
    entries: List<NavBackStackEntry>,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
): Unit

{@inheritDoc}

This method should always call FragmentTransaction.setPrimaryNavigationFragment so that the Fragment associated with the new destination can be retrieved with FragmentManager.getPrimaryNavigationFragment.

Note that the default implementation commits the new Fragment asynchronously, so the new Fragment is not instantly available after this call completes.

This call will be ignored if the FragmentManager state has already been saved.