NavOptions stores special options for navigate actions

Summary

Nested types

Builder for constructing new instances of NavOptions.

Public constructors

android

Public functions

Boolean

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

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

Cmn
android
Boolean

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

Cmn
android
Boolean

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

Cmn
android

Public properties

String?

Route for the destination to pop up to before navigating.

Cmn
android
KClass<*>?

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

Cmn
android
Any?

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

Cmn
android

Public constructors

NavOptions()

Public functions

isPopUpToInclusive

fun isPopUpToInclusive(): Boolean

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

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

shouldPopUpToSaveState

fun shouldPopUpToSaveState(): Boolean

Whether the back stack and the state of all destinations between the current destination and popUpToRoute should be saved for later restoration via Builder.setRestoreState or the restoreState attribute using the same ID as popUpToRoute (note: this matching ID is true if isPopUpToInclusive is true. If isPopUpToInclusive is false, this matching ID is the id of the last destination that is popped).

shouldRestoreState

fun shouldRestoreState(): Boolean

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

Public properties

popUpToRoute

var popUpToRouteString?

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

popUpToRouteClass

var popUpToRouteClassKClass<*>?

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<*>?

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

popUpToRouteObject

var popUpToRouteObjectAny?

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
Any?

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