The Developer Preview for Android 11 is now available; test it out and share your feedback.

OnDestinationChangedListener

interface OnDestinationChangedListener
androidx.navigation.NavController.OnDestinationChangedListener

OnDestinationChangedListener receives a callback when the getCurrentDestination() or its arguments change.

Summary

Public methods

abstract Unit
onDestinationChanged(@NonNull controller: NavController, @NonNull destination: NavDestination, @Nullable arguments: Bundle?)

Callback for when the getCurrentDestination() or its arguments change.

Public methods

onDestinationChanged

abstract fun onDestinationChanged(
    @NonNull controller: NavController,
    @NonNull destination: NavDestination,
    @Nullable arguments: Bundle?
): Unit

Callback for when the getCurrentDestination() or its arguments change. This navigation may be to a destination that has not been seen before, or one that was previously on the back stack. This method is called after navigation is complete, but associated transitions may still be playing.

Parameters
controller NavController: the controller that navigated
destination NavDestination: the new destination
arguments Bundle?: the arguments passed to the destination