NavType.ParcelableArrayType


public final class NavType.ParcelableArrayType<D extends Parcelable> extends NavType


ParcelableArrayType is used for NavArguments which hold arrays of Parcelables.

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

Summary

Public constructors

Public methods

boolean
equals(Object other)
D[]
get(@NonNull SavedState 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 SavedState bundle, @NonNull String key, D[] value)

Put a value of this type in the bundle

boolean
valueEquals(D[] value, D[] other)

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

Inherited methods

From androidx.navigation.NavType
boolean

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

D[]
parseValue(@NonNull String value, 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
serializeAsValue(D[] value)

Serialize a value of this NavType into a String.

@NonNull String

Public constructors

ParcelableArrayType

public <D extends Parcelable> ParcelableArrayType(@NonNull Class<@NonNull D> type)
Parameters
@NonNull Class<@NonNull D> type

the type of Parcelable component class of the array

Public methods

equals

public boolean equals(Object other)

get

public D[] get(@NonNull SavedState bundle, @NonNull String key)

Get a value of this type from the bundle

Parameters
@NonNull SavedState bundle

SavedState to get value from

@NonNull String key

SavedState 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.9.0-alpha04
public @NonNull D[] parseValue(@NonNull String value)
Throws
kotlin.UnsupportedOperationException

since Arrays do not support default values

put

public void put(@NonNull SavedState bundle, @NonNull String key, D[] value)

Put a value of this type in the bundle

Parameters
@NonNull SavedState bundle

SavedState to put value in

@NonNull String key

SavedState key

D[] value

value of this type

valueEquals

Added in 2.8.0
public boolean valueEquals(D[] value, D[] other)

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

Parameters
D[] value

the first value for comparison

D[] other

the second value for comparison