NavType.EnumType

class NavType.EnumType<D : Enum<*>> : NavType.SerializableType


EnumType is used for NavArguments holding enum values.

Null values are not supported. To specify a default value in a Navigation XML file, simply use the enum constant without the class name, e.g. app:defaultValue="MONDAY".

Summary

Public constructors

<D : Enum<*>> EnumType(type: Class<D>)

Public functions

open D

Parse a value of this type from a String.

Public properties

open String

The name of this type.

Inherited functions

From androidx.navigation.NavType
open D
parseValue(value: String, previousValue: D)

Parse a value of this type from a String and then combine that parsed value with the given previousValue of the same type to provide a new value that contains both the new and previous value.

open String
serializeAsValue(value: D)

Serialize a value of this NavType into a String.

open String
From androidx.navigation.NavType.SerializableType
open operator Boolean
equals(other: Any?)
open operator D?
get(bundle: Bundle, key: String)

Get a value of this type from the bundle

open Int
open Unit
put(bundle: Bundle, key: String, value: D)

Put a value of this type in the bundle

Inherited properties

From androidx.navigation.NavType
open Boolean

Check if an argument with this type can hold a null value.

Public constructors

EnumType

<D : Enum<*>> EnumType(type: Class<D>)
Parameters
type: Class<D>

the Enum class that is supported by this NavType

Public functions

parseValue

open fun parseValue(value: String): D

Parse a value of this type from a String.

Parameters
value: String

string representation of a value of this type

Returns
D

parsed value of the type represented by this NavType

Throws
kotlin.IllegalArgumentException

if value cannot be parsed into this type

Public properties

name

open val nameString

The name of this type.

This is the same value that is used in Navigation XML argType attribute.

Returns
String

name of this type