public final class NavOptions


NavOptions stores special options for navigate actions

Summary

Nested types

public final class NavOptions.Builder

Builder for constructing new instances of NavOptions.

Public methods

boolean
equals(Object other)
final @AnimatorRes @AnimRes int

The custom enter Animation/Animator that should be run.

final @AnimatorRes @AnimRes int

The custom exit Animation/Animator that should be run.

final @AnimatorRes @AnimRes int

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

final @AnimatorRes @AnimRes int

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

final @IdRes int

This method is deprecated. Use popUpToId instead.

final @IdRes int

The destination to pop up to before navigating.

final String

Route for the destination to pop up to before navigating.

final KClass<@NonNull ?>

Route from a KClass for the destination to pop up to before navigating.

final Object

Route from an Object for the destination to pop up to before navigating.

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.

@NonNull String

Public methods

equals

public boolean equals(Object other)

getEnterAnim

Added in 1.0.0
public final @AnimatorRes @AnimRes int getEnterAnim()

The custom enter Animation/Animator that should be run.

Returns
@AnimatorRes @AnimRes int

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

getExitAnim

Added in 1.0.0
public final @AnimatorRes @AnimRes int getExitAnim()

The custom exit Animation/Animator that should be run.

Returns
@AnimatorRes @AnimRes int

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

getPopEnterAnim

Added in 1.0.0
public final @AnimatorRes @AnimRes int getPopEnterAnim()

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

Returns
@AnimatorRes @AnimRes int

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

getPopExitAnim

Added in 1.0.0
public final @AnimatorRes @AnimRes int getPopExitAnim()

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

Returns
@AnimatorRes @AnimRes int

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

getPopUpTo

Added in 1.0.0
Deprecated in 2.4.0
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

getPopUpToId

Added in 2.4.0
public final @IdRes int getPopUpToId()

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

getPopUpToRoute

Added in 2.4.0
public final String getPopUpToRoute()

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

Returns
String

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

getPopUpToRouteClass

Added in 2.8.0
public final KClass<@NonNull ?> getPopUpToRouteClass()

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

Returns
KClass<@NonNull ?>

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

getPopUpToRouteObject

Added in 2.8.0
public final Object getPopUpToRouteObject()

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

Returns
Object

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

hashCode

public int hashCode()

isPopUpToInclusive

Added in 1.0.0
public final boolean isPopUpToInclusive()

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

shouldLaunchSingleTop

Added in 1.0.0
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

Added in 2.4.0
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

Added in 2.4.0
public final boolean shouldRestoreState()

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

toString

public @NonNull String toString()