I'm struggling how can I pass an array with objects from activity to service by intent. After debugging i can say that my service doesnt even start because of error java.lang.RuntimeException: Parcel: unable to marshal value (Item(id=0, data=2023-01-02T02:07:11.051, message=123, isValid=false.
listViewModel.itemList.observe(this) {
listAdapter.setList(it)
recyclerView.adapter = listAdapter
val i = Intent(this, FileService::class.java)
val bundle = Bundle()
bundle.putSerializable("data", it)
i.putExtras(bundle)
startService(i)
}
and my data class
@Serializable
data class Item(val id: Int,
val data: LocalDateTime? = Clock.System.now().toLocalDateTime(TimeZone.UTC),
val message: String,
var isValid: Boolean? = false)
As you can see im not using parcelable. I have no idea what to do. I have tried option without bundle.