I get a StackOverflowError due to a deeply nested object structure I'm 
putting into the Bundle in onSaveInstanceState (compare 
http://stackoverflow.com/questions/438875/stackoverflowerror-when-ser...<http://www.google.com/url?sa=D&q=http://stackoverflow.com/questions/438875/stackoverflowerror-when-serializing-an-object-in-java>
). 

To prevent this from happening I wrote custom writeObject/readObject methods 
for the one object causing the trouble (basically serializing it iteratively 
instead of recursively).

What happens is: 
- I rotate the phone 
- onSaveInstanceState() is called --> 
outState.putSerializable("key", myObject); 
- the custom writeObject method is NOT called 
- activity is destroyed and newly created 
- in onCreate(Bundle savedInstanceState) the object is restored but again 
without calling my custom readObject method 

I analyzed the Android code for Bundle, Parcel and ObjectOutputStream and 
IMHO it should invoke my custom methods but it doesn't. 

Any ideas how to make this work? 

And no it's not an option to write it as a Parcel instead, I would have to 
add the Parcelable code to around 100 classes.

Best Regards 

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

Reply via email to