Hi Dianne
1. Everything I try to persist is UI state, some UIs are just a little more complex than others. Persisting it some other way doesn't make sense because it is indeed just part of the UI and not needed anywhere else. 2. I'm not persisting objects of 100 different classes at once but only a couple of them at a time, depending on what is displayed. But if I had to change everything to Parcelable instead of Serializable I would have to touch 100 classes because any of these could potentially be used on this particular screen. 3. The problem is not the amount of objects I try to persist but the recursive structure. Standard Java serialization keeps a record of every object written to a stream. If the same object is encountered a second time, only a reference to it is written to the stream, and not a second copy of the object; so circular references aren't the problem here. The real problem is the deeply nested structure of the objects (a-->b-->c-->d etc.) which will be serialized recursively with standard Java serialization and requires a stack frame for each recursive call. 4. But the actual question is if or why the Bundle doesn't use the standard Java serialization if an object is put into with with putSerializable? I would expect my custom writeObject method to be called if I use the putSerializable. Why would Android not use the standard serialization mechanism? What other way do I have to prevent the StackOverflowError? 5. (ok there is one other way: write everything into a byte[] using ObjectOutputStream.writeObject() on top of a ByteArrayOutputStream and then put the byte[] into the Bundle, but I'm looking for a more elegant solution and one that answers my question why the writeObject method isn't called by the Bundle/Parcel classes). Emanuel Moecklin 1gravity LLC -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

