NavType.EnumType



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>)
android

Public functions

open D

Parse a value of this type from a String.

android

Public properties

open String

The name of this type.

android

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.

android
open String
serializeAsValue(value: D)

Serialize a value of this NavType into a String.

android
open String
android
open Boolean
valueEquals(value: D, other: D)

Compares two values of type T and returns true if values are equal.

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

Get a value of this type from the bundle

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

Put a value of this type in the bundle

android

Inherited properties

From androidx.navigation.NavType
open Boolean

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

android

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