Navigation is a framework for navigating between 'destinations' within an Android application that provides a consistent API whether destinations are implemented as Fragments, Activities, or other components.

There are 3 major components in Navigation.

Below is an example of working with a NavController.
 // File:
 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
   // For example purposes, assume our layout created in onCreateView has a Button
   // that should navigate the user to a destination
   Button b = view.findViewById(;

   b.setOnClickListener(v -> {
       // Retrieve the NavController from any View within a NavHost
       NavController navController = Navigation.findNavController(v);

   // Or use the convenience method in Navigation to combine the previous steps

Please see the documentation of individual classes for details.


NavDestination.ClassType This optional annotation allows tooling to offer auto-complete for the android:name attribute. 
Navigator.Name This annotation should be added to each Navigator subclass to denote the default name used to register the Navigator with a NavigatorProvider


NavController.OnNavigatedListener OnNavigatorNavigatedListener receives a callback when the associated controller navigates to a new destination. 
NavDirections An interface that describes a navigation operation: action's id and arguments  
NavHost A host is a single context or container for navigation via a NavController
Navigator.Extras Interface indicating that this class should be passed to its respective Navigator to enable Navigator specific behavior. 
Navigator.OnNavigatorNavigatedListener Listener for observing navigation events for this specific navigator. 
NavigatorProvider A NavigationProvider stores a set of Navigators that are valid ways to navigate to a destination. 


ActivityNavigator ActivityNavigator implements cross-activity navigation. 
ActivityNavigator.Destination NavDestination for activity navigation  
ActivityNavigator.Extras Extras that can be passed to ActivityNavigator to customize what ActivityOptionsCompat are passed through to the call to ContextCompat.startActivity(Context, Intent, Bundle)
NavAction Navigation actions provide a level of indirection between your navigation code and the underlying destinations. 
NavController NavController manages app navigation within a NavHost
NavDeepLinkBuilder Class used to construct deep links to a particular destination in a NavGraph
NavDestination NavDestination represents one node within an overall navigation graph. 
NavGraph NavGraph is a collection of NavDestination nodes fetchable by ID. 
NavGraphNavigator A Navigator built specifically for NavGraph elements. 
Navigation Entry point for navigation operations. 
Navigator<D extends NavDestination> Navigator defines a mechanism for navigating within an app. 
NavInflater Class which translates a navigation XML file into a NavGraph  
NavOptions NavOptions stores special options for navigate actions  
NavOptions.Builder Builder for constructing new instances of NavOptions.