Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

NavOptions

class NavOptions
kotlin.Any
   ↳ androidx.navigation.NavOptions

NavOptions stores special options for navigate actions

Summary

Nested classes

Builder for constructing new instances of NavOptions.

Public methods
Boolean

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

Int

The custom enter Animation/Animator that should be run.

Int

The custom exit Animation/Animator that should be run.

Int

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

Int

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

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).

Int

The destination to pop up to before navigating.

Public methods

isPopUpToInclusive

fun isPopUpToInclusive(): Boolean

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

getEnterAnim

@AnimRes @AnimatorRes fun getEnterAnim(): Int

The custom enter Animation/Animator that should be run.

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

getExitAnim

@AnimRes @AnimatorRes fun getExitAnim(): Int

The custom exit Animation/Animator that should be run.

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

getPopEnterAnim

@AnimRes @AnimatorRes fun getPopEnterAnim(): Int

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

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

getPopExitAnim

@AnimRes @AnimatorRes fun getPopExitAnim(): Int

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

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

shouldLaunchSingleTop

fun shouldLaunchSingleTop(): 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).

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

getPopUpTo

@IdRes fun getPopUpTo(): Int

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

Return
Int: the destinationId to pop up to, clearing all intervening destinations