NavDestination.Companion
object NavDestination.Companion
Summary
Protected functions |
|
---|---|
Class<C?> |
<C : Any?> parseClassFromName( Parse the class associated with this destination from a raw name, generally extracted from the |
Public properties |
|
---|---|
Sequence<NavDestination> |
Provides a sequence of the NavDestination's hierarchy. |
Protected functions
parseClassFromName
protected fun <C : Any?> parseClassFromName(
context: Context,
name: String,
expectedClassType: Class<C?>
): Class<C?>
Parse the class associated with this destination from a raw name, generally extracted from the android:name
attribute added to the destination's XML. This should be the class providing the visual representation of the destination that the user sees after navigating to this destination.
This method does name -> Class caching and should be strongly preferred over doing your own parsing if your Navigator
supports the android:name
attribute to give consistent behavior across all Navigators.
Parameters | |
---|---|
context: Context |
Context providing the package name for use with relative class names and the ClassLoader |
name: String |
Absolute or relative class name. Null names will be ignored. |
expectedClassType: Class<C?> |
The expected class type |
Returns | |
---|---|
Class<C?> |
The parsed class |
Throws | |
---|---|
kotlin.IllegalArgumentException: kotlin.IllegalArgumentException |
if the class is not found in the provided Context's ClassLoader or if the class is not of the expected type |
Public properties
hierarchy
val NavDestination.hierarchy: Sequence<NavDestination>
Provides a sequence of the NavDestination's hierarchy. The hierarchy starts with this destination itself and is then followed by this destination's NavDestination.parent
, then that graph's parent, and up the hierarchy until you've reached the root navigation graph.