ActivityNavigator

@Navigator.Name(value = "activity") public class ActivityNavigator extends Navigator

Object
   ↳ Navigator
     ↳ ActivityNavigator
Known direct subclasses
DynamicActivityNavigator

Dynamic feature navigator for Activity destinations.


ActivityNavigator implements cross-activity navigation.

Summary

Nested types

ActivityNavigator.Companion
ActivityNavigator.Destination

NavDestination for activity navigation

ActivityNavigator.Extras

Extras that can be passed to ActivityNavigator to customize what ActivityOptionsCompat and flags are passed through to the call to ActivityCompat.startActivity.

ActivityNavigator.Extras.Builder

Builder for constructing new Extras instances.

Public constructors

Public methods

@NonNull ActivityNavigator.Destination

Construct a new NavDestination associated with this Navigator.

@Nullable NavDestination
navigate(
    @NonNull ActivityNavigator.Destination destination,
    @Nullable Bundle args,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

boolean

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

Inherited methods

From class Navigator
void
navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    @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.

void

Restore any state previously saved in onSaveState.

@Nullable Bundle

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

void
popBackStack(@NonNull NavBackStackEntry popUpTo, boolean savedState)

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

Public constructors

ActivityNavigator

public final ActivityNavigator(@NonNull Context context)

Public methods

createDestination

@NonNull
public ActivityNavigator.Destination 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.

Returns
ActivityNavigator.Destination

a new NavDestination

@Nullable
public NavDestination navigate(
    @NonNull ActivityNavigator.Destination destination,
    @Nullable Bundle args,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

Requests navigation to a given destination associated with this navigator in the navigation graph. This method generally should not be called directly; NavController will delegate to it when appropriate.

Parameters
@NonNull ActivityNavigator.Destination destination

destination node to navigate to

@Nullable Bundle args

arguments to use for navigation

@Nullable NavOptions navOptions

additional options for navigation

@Nullable