ActivityNavigator

public class ActivityNavigator
extends Navigator<ActivityNavigator.Destination>

java.lang.Object
   ↳ androidx.navigation.Navigator<androidx.navigation.ActivityNavigator.Destination>
     ↳ androidx.navigation.ActivityNavigator


ActivityNavigator implements cross-activity navigation.

Summary

Nested classes

class ActivityNavigator.Destination

NavDestination for activity navigation  

class ActivityNavigator.Extras

Extras that can be passed to ActivityNavigator to customize what ActivityOptionsCompat are passed through to the call to ContextCompat.startActivity(Context, Intent, Bundle)

Inherited constants

Public constructors

ActivityNavigator(Context context)

Public methods

ActivityNavigator.Destination createDestination()

Construct a new NavDestination associated with this Navigator.

void navigate(ActivityNavigator.Destination destination, Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras)

Navigate to a destination.

boolean popBackStack()

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

Inherited methods

Public constructors

ActivityNavigator

public ActivityNavigator (Context context)

Parameters
context Context

Public methods

createDestination

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

public void navigate (ActivityNavigator.Destination destination, 
                Bundle args, 
                NavOptions navOptions, 
                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.

Implementations should dispatchOnNavigatorNavigated(int, int) to notify listeners of the resulting navigation destination.

Parameters
destination ActivityNavigator.Destination: destination node to navigate to

args Bundle: arguments to use for navigation

navOptions NavOptions: additional options for navigation

navigatorExtras Navigator.Extras: extras unique to your Navigator.

popBackStack

public boolean popBackStack ()

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

Implementations should dispatchOnNavigatorNavigated(int, int) to notify listeners of the resulting navigation destination and return true if navigation was successful. Implementations should return false if navigation could not be performed, for example if the navigator's back stack was empty.

Returns
boolean true if pop was successful