NavigatorProvider
public
class
NavigatorProvider
extends Object
| java.lang.Object | |
| ↳ | androidx.navigation.NavigatorProvider |
A NavigationProvider stores a set of Navigators that are valid ways to navigate
to a destination.
Summary
Public constructors | |
|---|---|
NavigatorProvider()
|
|
Public methods | |
|---|---|
final
Navigator<? extends NavDestination>
|
addNavigator(Navigator<? extends NavDestination> navigator)
Register a navigator using the name provided by the
|
Navigator<? extends NavDestination>
|
addNavigator(String name, Navigator<? extends NavDestination> navigator)
Register a navigator by name. |
final
<T extends Navigator<?>>
T
|
getNavigator(Class<T> navigatorClass)
Retrieves a registered |
<T extends Navigator<?>>
T
|
getNavigator(String name)
Retrieves a registered |
Inherited methods | |
|---|---|
Public constructors
NavigatorProvider
public NavigatorProvider ()
Public methods
addNavigator
public final Navigator<? extends NavDestination> addNavigator (Navigator<? extends NavDestination> navigator)
Register a navigator using the name provided by the
Navigator.Name annotation. destinations may
refer to any registered navigator by name for inflation. If a navigator by this name is
already registered, this new navigator will replace it.
| Parameters | |
|---|---|
navigator |
Navigator: navigator to add |
| Returns | |
|---|---|
Navigator<? extends NavDestination> |
the previously added Navigator for the name provided by the
Navigator.Name annotation, if any
|
addNavigator
public Navigator<? extends NavDestination> addNavigator (String name, Navigator<? extends NavDestination> navigator)
Register a navigator by name. destinations may refer to any
registered navigator by name for inflation. If a navigator by this name is already
registered, this new navigator will replace it.
| Parameters | |
|---|---|
name |
String: name for this navigator |
navigator |
Navigator: navigator to add |
| Returns | |
|---|---|
Navigator<? extends NavDestination> |
the previously added Navigator for the given name, if any |
getNavigator
public final T getNavigator (Class<T> navigatorClass)
Retrieves a registered Navigator using the name provided by the
Navigator.Name annotation.
| Parameters | |
|---|---|
navigatorClass |
Class: class of the navigator to return |
| Returns | |
|---|---|
T |
the registered navigator with the given Navigator.Name |
| Throws | |
|---|---|
IllegalArgumentException |
if the Navigator does not have a
Navigator.Name annotation |
IllegalStateException |
if the Navigator has not been added |
See also:
getNavigator
public T getNavigator (String name)
Retrieves a registered Navigator by name.
| Parameters | |
|---|---|
name |
String: name of the navigator to return |
| Returns | |
|---|---|
T |
the registered navigator with the given name |
| Throws | |
|---|---|
IllegalStateException |
if the Navigator has not been added |
See also: