ActivityNavigator
@Navigator.Name(value = "activity")
public class ActivityNavigator extends Navigator
ActivityNavigator implements cross-activity navigation.
Summary
Nested types |
|---|
@NavDestination.ClassType(value = Activity)NavDestination for activity navigation |
public final class ActivityNavigator.Extras implements Navigator.ExtrasExtras that can be passed to ActivityNavigator to customize what |
public final class ActivityNavigator.Extras.BuilderBuilder for constructing new |
Public constructors |
|---|
ActivityNavigator(@NonNull Context context) |
Public methods |
|
|---|---|
static final void |
applyPopAnimationsToPendingTransition(@NonNull Activity activity)Apply any pop animations in the Intent of the given Activity to a pending transition. |
@NonNull ActivityNavigator.Destination |
Construct a new NavDestination associated with this Navigator. |
NavDestination |
navigate(Navigate to a destination. |
boolean |
Attempt to pop this navigator's back stack, performing the appropriate navigation. |
Inherited methods |
||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public methods
applyPopAnimationsToPendingTransition
public static final void applyPopAnimationsToPendingTransition(@NonNull 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 to get the appropriate pop animations.
| Parameters | |
|---|---|
@NonNull Activity activity |
An activity started from the |
| See also | |
|---|---|
popEnterAnim |
|
popExitAnim |
createDestination
public @NonNull 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 | |
|---|---|
@NonNull ActivityNavigator.Destination |
a new NavDestination |
navigate
public NavDestination navigate(
@NonNull 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 | |
|---|---|
@NonNull ActivityNavigator.Destination destination |
destination node to navigate to |
Bundle args |
arguments to use for navigation |
NavOptions navOptions |
additional options for navigation |
Navigator.Extras navigatorExtras |
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). |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if the given destination has no Intent |
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 |
|