Backendless Support
 
Answered

Unable to delete child after passing object between activities

Lets say I have a parent and a child object. When I remove the child from the parent in the same activity it works. However when I pass the serialized parent into a new activity and try to remove the child it does not work.

How can I remove the child from the parent after passing it between activities?

Best Answer
photo

Hi Frank,

I see what's going.. once the object is serialized/deserialized, it looses the __meta property which is crucial for determining (by the server) what has changed in the object. Sony add a public field String __meta to the parent class and it should fix it.

Regards,

Mark

Leave a Comment

Comments (5)

photo
1

Hi Frank,

What does the parent object in the new activity look like after you remove the child? Can you take a "snapshot" of the entire object hierarchy (perhaps in the debugger) and share it with us?

Regards,

Mark

photo
1

Hi Mark,

As attached the snapshot of the parent. I've created a demo project which can be found at:

https://github.com/fathomson/backendless_parent_child

When I save the childless parent it responds with a childless parent. However in the backendless console the parent still has a child as is when i do a findbyid.

Regards,

Frank

photo
2

Hi Frank,

I see what's going.. once the object is serialized/deserialized, it looses the __meta property which is crucial for determining (by the server) what has changed in the object. Sony add a public field String __meta to the parent class and it should fix it.

Regards,

Mark

photo
1

Hi Mark,

That worked, thanks for the quick response!

Was that something I could have found in the documentation somewhere?

Kind regards,

Frank

photo
1

Hi Frank,

No, it is one of the edge use-cases which is not covered in the docs.

Regards,

Mark