NavigatorProvider
open class NavigatorProvider
kotlin.Any | |
↳ | androidx.navigation.NavigatorProvider |
A NavigationProvider stores a set of Navigator
s that are valid ways to navigate to a destination.
Summary
Public constructors | |
---|---|
<init>() A NavigationProvider stores a set of |
Public methods | |
---|---|
Navigator<out NavDestination!>? |
addNavigator(@NonNull : Navigator<out NavDestination!>) Register a navigator using the name provided by the |
open Navigator<out NavDestination!>? |
addNavigator(@NonNull : String, @NonNull : Navigator<out NavDestination!>) Register a navigator by name. |
T |
getNavigator(@NonNull : Class<T>) Retrieves a registered |
open T |
getNavigator(@NonNull : String) Retrieves a registered |
Extension functions | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
From androidx.navigation
|
||||||||||
From androidx.navigation.dynamicfeatures
|
Public constructors
<init>
NavigatorProvider()
A NavigationProvider stores a set of Navigator
s that are valid ways to navigate to a destination.
Public methods
addNavigator
@Nullable fun addNavigator(@NonNull : Navigator<out NavDestination!>): Navigator<out NavDestination!>?
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<out NavDestination!>: navigator to add |
Return | |
---|---|
Navigator<out NavDestination!>? |
the previously added Navigator for the name provided by the Navigator.Name annotation , if any |
addNavigator
@CallSuper @Nullable open fun addNavigator(
@NonNull : String,
@NonNull : Navigator<out NavDestination!>
): Navigator<out NavDestination!>?
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<out NavDestination!>: navigator to add |
Return | |
---|---|
Navigator<out NavDestination!>? |
the previously added Navigator for the given name, if any |
getNavigator
@NonNull fun <T : Navigator<*>!> getNavigator(@NonNull : Class<T>): T
Retrieves a registered Navigator
using the name provided by the Navigator.Name annotation
.
Parameters | |
---|---|
navigatorClass |
Class<T>: class of the navigator to return |
Return | |
---|---|
T |
the registered navigator with the given Navigator.Name |
Exceptions | |
---|---|
IllegalArgumentException |
if the Navigator does not have a Navigator.Name annotation |
IllegalStateException |
if the Navigator has not been added |
See Also
getNavigator
@CallSuper @NonNull open fun <T : Navigator<*>!> getNavigator(@NonNull : String): T
Retrieves a registered Navigator
by name.
Parameters | |
---|---|
name |
String: name of the navigator to return |
Return | |
---|---|
T |
the registered navigator with the given name |
Exceptions | |
---|---|
IllegalStateException |
if the Navigator has not been added |
See Also