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
|
Public constructors | |
---|---|
ActivityNavigator(Context context)
|
Public methods | |
---|---|
static
void
|
applyPopAnimationsToPendingTransition(Activity activity)
Apply any pop animations in the Intent of the given Activity to a pending transition. |
ActivityNavigator.Destination
|
createDestination()
Construct a new NavDestination associated with this Navigator. |
NavDestination
|
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
Public methods
applyPopAnimationsToPendingTransition
public static void applyPopAnimationsToPendingTransition (Activity activity)
Apply any pop animations in the Intent of the given Activity to a pending transition.
This should be used in place of Activity.overridePendingTransition(int, int)
to get the appropriate pop animations.
Parameters | |
---|---|
activity |
Activity : An activity started from the ActivityNavigator . |
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 |
navigate
public NavDestination 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.
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. |
Returns | |
---|---|
NavDestination |
The NavDestination that should be added to the back stack or null if no change was made to the back stack (i.e., in cases of single top operations where the destination is already on top of the back stack). |
popBackStack
public boolean popBackStack ()
Attempt to pop this navigator's back stack, performing the appropriate navigation.
Implementations should 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
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.