> I don't really see how it would help. It says in the documentation
> that this can be used for optimizing performance when the
> configuration changes, e.g. for passing around objects that are
> expensive to construct or serialize. However, it is mentioned that
> this is not a replacement for onSaveInstanceState() and that one must
> still implement the latter (which then performs the expensive
> serialization).

onSaveInstanceState() is called in cases other than screen rotations
(e.g., activity is being closed up due to low memory), and in those other
cases, onRetainNonConfigurationInstance() is not used at all.

> Since onRetainNonConfigurationInstance() is called after
> onSaveInstanceState(), there is also no way to check whether the
> former method has already been called, so you must always serialize/
> parcel the expensive object in advance.

Well, there are two scenarios:

-- You're focusing on the "it's expensive to serialize" scenario

-- There's also the "it can't be serialized" scenario, such as a Java socket

I tend to focus on onRetainNonConfigurationInstance() for that latter
scenario, to cover things that just aren't possible to serialize.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!



--~--~---------~--~----~------------~-------~--~----~
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