androidx.navigation
Fragments, Activities, or
other components.
There are 3 major components in Navigation.
NavGraph: A navigation graph encapsulates a set ofdestinations. It can be created by inflating a navigation XML file, by constructing it programmatically, or a combination of the two.NavController: This is the main entry point for interacting with the Navigation Graph, translating calls tonavigate(int),popBackStack(), andnavigateUp()into the appropriate operations.NavHost: The container that hosts aNavControllerand provides support for one or more specific types ofdestinations. For example,NavHostFragmentallows you to usefragment destinations.
// File: HomeFragment.java
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(R.id.view_details);
b.setOnClickListener(v -> {
// Retrieve the NavController from any View within a NavHost
NavController navController = Navigation.findNavController(v);
navController.navigate(R.id.details));
}
// Or use the convenience method in Navigation to combine the previous steps
b.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.details));
}
Please see the documentation of individual classes for details.
Annotations
| 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.
|
Interfaces
| FloatingWindow |
A marker interface for NavDestination subclasses that float above the view of other
destinations (i.e.
|
| NavArgs | An interface marking generated Args classes. |
| NavController.OnDestinationChangedListener |
OnDestinationChangedListener receives a callback when the
NavController.getCurrentDestination() or its arguments change.
|
| 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.
|
Classes
| ActionOnlyNavDirections |
An implementation of NavDirections without any arguments.
|
| 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 and flags are passed through to the call to
ContextCompat.startActivity(Context, Intent, Bundle).
|
| ActivityNavigator.Extras.Builder |
Builder for constructing new ActivityNavigator.Extras instances.
|
| NavAction | Navigation actions provide a level of indirection between your navigation code and the underlying destinations. |
| NavArgument |
NavArgument denotes an argument that is supported by a NavDestination.
|
| NavArgument.Builder |
A builder for constructing NavArgument instances.
|
| NavBackStackEntry |
Representation of an entry in the back stack of a NavController.
|
| NavController |
NavController manages app navigation within a NavHost.
|
| NavDeepLink | NavDeepLink encapsulates the parsing and matching of a navigation deep link. |
| NavDeepLink.Builder |
A builder for constructing NavDeepLink instances.
|
| NavDeepLinkBuilder |
Class used to construct deep links to a particular destination in a NavGraph.
|
| NavDeepLinkRequest |
A request for a deep link in a NavDestination.
|
| NavDeepLinkRequest.Builder |
A builder for constructing NavDeepLinkRequest instances.
|
| 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.
|
| NavHostController |
Subclass of NavController that offers additional APIs for use by a
NavHost to connect the NavController to external dependencies.
|
| Navigation | Entry point for navigation operations. |
| Navigator<D extends NavDestination> | Navigator defines a mechanism for navigating within an app. |
| NavigatorProvider |
A NavigationProvider stores a set of Navigators that are valid ways to navigate
to a destination.
|
| 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. |
| NavType<T> |
NavType denotes the type that can be used in a NavArgument.
|
| NavType.EnumType<D extends Enum> |
EnumType is used for NavArguments holding enum values.
|
| NavType.ParcelableArrayType<D extends Parcelable> |
ParcelableArrayType is used for NavArguments which hold arrays of Parcelables.
|
| NavType.ParcelableType<D> |
ParcelableType is used for passing Parcelables in NavArguments.
|
| NavType.SerializableArrayType<D extends Serializable> |
SerializableArrayType is used for NavArguments that hold arrays of Serializables.
|
| NavType.SerializableType<D extends Serializable> |
SerializableType is used for Serializable NavArguments.
|
Annotations
Interfaces
Classes
- ActionOnlyNavDirections
- ActivityNavigator
- ActivityNavigator.Destination
- ActivityNavigator.Extras
- ActivityNavigator.Extras.Builder
- NavAction
- NavArgument
- NavArgument.Builder
- NavBackStackEntry
- NavController
- NavDeepLink
- NavDeepLink.Builder
- NavDeepLinkBuilder
- NavDeepLinkRequest
- NavDeepLinkRequest.Builder
- NavDestination
- NavGraph
- NavGraphNavigator
- NavHostController
- Navigation
- Navigator
- NavigatorProvider
- NavInflater
- NavOptions
- NavOptions.Builder
- NavType
- NavType.EnumType
- NavType.ParcelableArrayType
- NavType.ParcelableType
- NavType.SerializableArrayType
- NavType.SerializableType