NavType.SerializableType


open class NavType.SerializableType<D : Serializable> : NavType

Known direct subclasses
NavType.EnumType

EnumType is used for NavArguments holding enum values.


SerializableType is used for Serializable NavArguments. For handling Enums you must use EnumType instead.

Null values are supported. Default values in Navigation XML files are not supported.

See also
NavType.EnumType

Summary

Public constructors

Constructs a NavType that supports a given Serializable type.

Public functions

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 D
open Unit
put(bundle: Bundle, key: String, value: D)

Put a value of this type in the bundle

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
open Boolean
valueEquals(value: D, other: D)

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

Inherited properties

From androidx.navigation.NavType
open Boolean

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

Public constructors

SerializableType

<D : Serializable> SerializableType(type: Class<D>)

Constructs a NavType that supports a given Serializable type.

Parameters
type: Class<D>

class that is a subtype of Serializable

Public functions

equals

open operator fun equals(other: Any?): Boolean

get

Added in 2.9.0-alpha03
open operator fun get(bundle: Bundle, key: String): D?

Get a value of this type from the bundle

Parameters
bundle: Bundle

bundle to get value from

key: String

bundle key

Returns
D?

value of this type

hashCode

open fun hashCode(): Int

parseValue

Added in 2.9.0-alpha03
open fun parseValue(value: String): D
Throws
kotlin.UnsupportedOperationException

since Serializables do not support default values

put

Added in 1.0.0
open fun put(bundle: Bundle, key: String, value: D): Unit

Put a value of this type in the bundle

Parameters
bundle: Bundle

bundle to put value in

key: String

bundle key

value: D

value of 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