NavOptions

public final class NavOptions


NavOptions stores special options for navigate actions

Summary

Nested types

NavOptions.Builder

Builder for constructing new instances of NavOptions.

Public fields

final int

The custom enter Animation/Animator that should be run.

final int

The custom exit Animation/Animator that should be run.

final int

The custom enter Animation/Animator that should be run when this destination is popped from the back stack.

final int

The custom exit Animation/Animator that should be run when this destination is popped from the back stack.

final @IdRes int

The destination to pop up to before navigating.

final @Nullable String

Route for the destination to pop up to before navigating.

Public methods

boolean
final @IdRes int

This method is deprecated. Use popUpToId instead.

int
final boolean

Whether the destination set in getPopUpTo should be popped from the back stack.

final boolean

Whether this navigation action should launch as single-top (i.e., there will be at most one copy of a given destination on the top of the back stack).

final boolean

Whether the back stack and the state of all destinations between the current destination and popUpToId should be saved for later restoration via Builder.setRestoreState or the restoreState attribute using the same ID as popUpToId (note: this matching ID is true whether isPopUpToInclusive is true or false).

final boolean

Whether this navigation action should restore any state previously saved by Builder.setPopUpTo or the popUpToSaveState attribute.

Public fields

enterAnim

@NonNull
public final int enterAnim

The custom enter Animation/Animator that should be run.

Returns
int

the resource id of a Animation or Animator or -1 if none.

exitAnim

@NonNull
public final int exitAnim

The custom exit Animation/Animator that should be run.

Returns
int

the resource id of a Animation or Animator or -1 if none.

popEnterAnim

@NonNull
public final int popEnterAnim

The custom enter Animation/Animator that should be run when this destination is popped from the back stack.

Returns
int

the resource id of a Animation or Animator or -1 if none.

popExitAnim

@NonNull
public final int popExitAnim

The custom exit Animation/Animator that should be run when this destination is popped from the back stack.

Returns
int

the resource id of a Animation or Animator or -1 if none.

popUpToId

@IdRes
@NonNull
public final @IdRes int popUpToId

The destination to pop up to before navigating. When set, all non-matching destinations should be popped from the back stack.

Returns
@IdRes int

the destinationId to pop up to, clearing all intervening destinations

popUpToRoute

@Nullable
public final @Nullable String popUpToRoute

Route for the destination to pop up to before navigating. When set, all non-matching destinations should be popped from the back stack.

Returns
@Nullable String

the destination route to pop up to, clearing all intervening destinations

Public methods

equals

@NonNull
public boolean equals(@Nullable Object other)

getPopUpTo

@IdRes
@NonNull
public final @IdRes int getPopUpTo()

The destination to pop up to before navigating. When set, all non-matching destinations should be popped from the back stack.

Returns
@IdRes int

the destinationId to pop up to, clearing all intervening destinations

hashCode

@NonNull
public int hashCode()

isPopUpToInclusive

@NonNull
public final boolean isPopUpToInclusive()

Whether the destination set in getPopUpTo should be popped from the back stack.

shouldLaunchSingleTop

@NonNull
public final boolean shouldLaunchSingleTop()

Whether this navigation action should launch as single-top (i.e., there will be at most one copy of a given destination on the top of the back stack).

This functions similarly to how android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP works with activities.

shouldPopUpToSaveState

@NonNull
public final boolean shouldPopUpToSaveState()

Whether the back stack and the state of all destinations between the current destination and popUpToId should be saved for later restoration via Builder.setRestoreState or the restoreState attribute using the same ID as popUpToId (note: this matching ID is true whether isPopUpToInclusive is true or false).

shouldRestoreState

@NonNull
public final boolean shouldRestoreState()

Whether this navigation action should restore any state previously saved by Builder.setPopUpTo or the popUpToSaveState attribute.