What should I pay attention to when uploading objects to an activity in android?
I implemented the Parcelable interface through serializable, because it was relatively lazy and I didn't want to implement the Parcelable interface.
1. Modify the Class. Because Serializable is passed, inherit implements Serializable after the class.
2. Pass the value
Intent. putExtra (sid, scart );
You can use putExtra directly.
3. Receive Value
Scart = (GoodsList_Details) intent. getSerializableExtra (sid );
In this way, we can basically solve the needs of more than 80% of our friends.
The above method is indeed feasible, but the class extension adds a field, so this transfer is not easy.
Error:
Java. lang. RuntimeException: Parcelable encountered IOException writing serializable object
Check all the classes on the Internet, including the referenced classes. serializable serialization is required.
View my code
Private List Items;
GoodsSpec has no serializable, so I don't hesitate to add this. Okay, everything is OK. record it.