TestNavHostController

public final class TestNavHostController extends NavController, NavHostController

Object
   ↳ NavController
     ↳ NavHostController
       ↳ TestNavHostController

Subclass of NavHostController that offers additional APIs for testing Navigation.

Summary

Public fields

final @NonNull List<@NonNull NavBackStackEntry>

Gets an immutable copy of the elements currently on the back stack.

Public constructors

Public methods

final void
setCurrentDestination(@IdRes int destId, Bundle args)

Navigate directly to any destination on the current androidx.navigation.NavGraph via an explicit deep link.

final void
setCurrentDestination(String destRoute, Bundle args)

Navigate directly to any destination on the current androidx.navigation.NavGraph via an explicit deep link.

Inherited methods

From class NavController
void

Adds an OnDestinationChangedListener to this controller to receive a callback whenever the currentDestination or its arguments change.

final @MainThread boolean
clearBackStack(@IdRes int destinationId)

Clears any saved state associated with destinationId that was previously saved via popBackStack when using a saveState value of true.

final @MainThread boolean

Clears any saved state associated with route that was previously saved via popBackStack when using a saveState value of true.

@NonNull NavDeepLinkBuilder

Create a deep link to a destination within this NavController.

@NonNull NavBackStackEntry
getBackStackEntry(@IdRes int destinationId)

Gets the topmost NavBackStackEntry for a destination id.

final @NonNull NavBackStackEntry</