SparseParcelableArraySerializer



A serializer for SparseArray. This serializer uses SavedState's API directly to save/load a SparseArray.

Note that this serializer should be used with SavedStateEncoder or SavedStateDecoder only. Using it with other Encoders/Decoders may throw IllegalArgumentException.

import androidx.savedstate.serialization.serializers.ParcelableArraySerializer
import androidx.savedstate.serialization.serializers.SparseParcelableArraySerializer

@Serializable
class MyModel(
    @Serializable(with = SparseParcelableArraySerializer::class)
    val sparseParcelableArray: android.util.SparseArray<android.os.Parcelable>
)

Summary

Public constructors

android

Public functions

open SparseArray<Parcelable>
deserialize(decoder: Decoder)
android
open Unit
serialize(encoder: Encoder, value: SparseArray<Parcelable>)
android

Public properties

open SerialDescriptor
android

Public constructors

SparseParcelableArraySerializer

SparseParcelableArraySerializer()

Public functions

deserialize

open fun deserialize(decoder: Decoder): SparseArray<Parcelable>

serialize

open fun serialize(encoder: Encoder, value: SparseArray<Parcelable>): Unit

Public properties

descriptor

open val descriptorSerialDescriptor