NavType.SerializableType

public class NavType.SerializableType<D extends Serializable> extends 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 methods

boolean
equals(Object other)
D
get(@NonNull Bundle bundle, @NonNull String key)

Get a value of this type from the bundle

@NonNull String

The name of this type.

int
@NonNull D
void
put(@NonNull Bundle bundle, @NonNull String key, @NonNull D value)

Put a value of this type in the bundle

Inherited methods

From androidx.navigation.NavType
boolean

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

@NonNull D
parseValue(@NonNull String value, @NonNull D previousValue)

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.

@NonNull String

Serialize a value of this NavType into a String.

@NonNull String

Public constructors

SerializableType

public <D extends Serializable> SerializableType(@NonNull Class<@NonNull D> type)

Constructs a NavType that supports a given Serializable type.

Parameters
@NonNull Class<@NonNull D> type

class that is a subtype of Serializable

Public methods

equals

public boolean equals(Object other)

get

Added in 2.8.0-alpha04
public D get(@NonNull Bundle bundle, @NonNull String key)

Get a value of this type from the bundle

Parameters
@NonNull Bundle bundle

bundle to get value from

@NonNull String key

bundle key

Returns
D

value of this type

getName

public @NonNull String getName()

The name of this type.

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

Returns
@NonNull String

name of this type

hashCode

public int hashCode()

parseValue

Added in 2.8.0-alpha04
public @NonNullparseValue(@NonNull String value)
Throws
kotlin.UnsupportedOperationException

since Serializables do not support default values

put

Added in 1.0.0
public void put(@NonNull Bundle bundle, @NonNull String key, @NonNull D value)

Put a value of this type in the bundle

Parameters
@NonNull Bundle bundle

bundle to put value in

@NonNull String key

bundle key

@NonNull D value

value of this type