Parcelable encountered IOException writing serializable object (name = xxx)

Source: Internet
Author: User
Parcelable encountered IOException writing serializable object (name = xxx)

Blog type:

  • Android Error
Java code
  1. Java. lang. RuntimeException: Parcelable encountered IOException writing serializable object (name = xxx)
  2. At android. OS. Parcel. writeSerializable (Parcel. java: 1160)
  3. At android. OS. Parcel. writeValue (Parcel. java: 1114)
  4. At android. OS. Parcel. writeMapInternal (Parcel. java: 479)
  5. At android. OS. Bundle. writeToParcel (Bundle. java: 1552)
  6. At android. OS. Parcel. writeBundle (Parcel. java: 493)
  7. At android. content. Intent. writeToParcel (Intent. java: 5438)
  8. At android. app. ActivityManagerProxy. startActivity (ActivityManagerNative. java: 1288)
  9. At android.app.Instrumentation.exe cStartActivity (Instrumentation. java: 1373)
  10. At android. app. Activity. startActivityForResult (Activity. java: 2817)
  11. At android. app. Activity. startActivity (Activity. java: 2923)
  12. At android. widget. AdapterView. javasmitemclick (AdapterView. java: 284)
  13. At android. widget. ListView. Upload mitemclick (ListView. java: 3382)
  14. At android. widget. AbsListView $ javasmclick. run (AbsListView. java: 1696)
  15. At android. OS. Handler. handleCallback (Handler. java: 587)
  16. At android. OS. Handler. dispatchMessage (Handler. java: 92)
  17. At android. OS. lorule. loop (lorule. java: 123)
  18. At android. app. ActivityThread. main (ActivityThread. java: 4627)
  19. At java. lang. reflect. Method. invokeNative (Native Method)
  20. At java. lang. reflect. Method. invoke (Method. java: 521)
  21. At com. android. internal. OS. ZygoteInit $ MethodAndArgsCaller. run (ZygoteInit. java: 868)
  22. At com. android. internal. OS. ZygoteInit. main (ZygoteInit. java: 626)
  23. At dalvik. system. NativeStart. main (Native Method)
  24. Caused by: java. io. NotSerializableException: org. mdx. activity. collaboration. CollaborationListActivity
  25. At java. io. ObjectOutputStream. writeNewObject (ObjectOutputStream. java: 1547)
  26. At java. io. ObjectOutputStream. writeObjectInternal (ObjectOutputStream. java: 1859)
  27. At java. io. ObjectOutputStream. writeObject (ObjectOutputStream. java: 1701)
  28. At java. io. ObjectOutputStream. writeObject (ObjectOutputStream. java: 1665)
  29. At java. io. ObjectOutputStream. writeFieldValues (ObjectOutputStream. java: 1153)
  30. At java. io. ObjectOutputStream. defaultWriteObject (ObjectOutputStream. java: 420)
  31. At java. io. objecttoutputstream. writeHierarchy (ObjectOutputStream. java: 1251)
  32. At java. io. ObjectOutputStream. writeNewObject (ObjectOutputStream. java: 1587)
  33. At java. io. ObjectOutputStream. writeObjectInternal (ObjectOutputStream. java: 1859)
  34. At java. io. ObjectOutputStream. writeObject (ObjectOutputStream. java: 1701)
  35. At java. io. ObjectOutputStream. writeObject (ObjectOutputStream. java: 1665)
  36. At android. OS. Parcel. writeSerializable (Parcel. java: 1155)

To transmit custom data between activities, implements Serializable or Parcelable interface is required.
You can use bundle putSerializable (String, Serizlizable) data or use intent putExtrr (String, Serizlizable) data directly.
I have a requirement to pass multiple custom data types, so I wrote a data class Value to encapsulate the custom data that I need. This class implements the Serizlizable interface. However, an error occurs during putExtra.

Later, I found that to transmit data between activities, all the content must implement the serializable interface, but a custom data encapsulated in my Value does not implement this interface, so an error occurs.
Then I set the custom type to implement the serializable interface.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.