0

I have a class, which contains an array list of another object, when I try to pass the data to another activity, it does not pass other objects like my array list Appointment, how to do? Here are my classes:

open class Customer(var name: String = "") : Serializable{
    var appointments: List<Appointment>? = null
}

And:

class Appointment(val id: String?, val title: String?, val date: Date) : Serializable { 
}

To pass data:

putExtra("customer", customer)

To get data:

intent.getSerializableExtra("customer") as Customer?

It works, but the list of appointments is not sent, only the customer, why?

The list is not null before doing the startActivity, but when I do the getIntent I get the null list, it was not sent

Mickael Belhassen
  • 2,970
  • 1
  • 25
  • 46
  • Possible duplicate of [Passing data through intent using Serializable](https://stackoverflow.com/questions/14333449/passing-data-through-intent-using-serializable) – vilpe89 Feb 12 '19 at 21:10
  • No, because I want to pass my object, and all the objects that are in it – Mickael Belhassen Feb 12 '19 at 21:15

1 Answers1

0

List doesn't implement Serializable.

How about try to use Arraylist.

Choim
  • 372
  • 1
  • 10