It might be enough, depending on the activity in question, but they are somewhat different beasts.

onSaveInstanceState / restore:

Provides automatic persistence of view states (edit control contents, list view and scroll view positions, etc).

The Bundle is retained by the framework and outlives the process.

You can store your own data objects in there, but this mechanism probably shouldn't be abused (for large data objects, store the id / key values, not the objects themselves).

It's of limited use for data storage anyway, because it can only store a limited number of types (primitives, arrays, parcelables, serializables), and not objects of arbitrary types.

onRetainNon... getLast... Instance:

- Does not persist view states;
- Is not retained by the framework beyond the destroy / create cycle;
- As a consequence, does not survive the process being killed;
- Can be used to carry over data objects of arbitrary size and type.

-- Kostya

17.04.2011 20:38, Streets Of Boston ?????:
I need to check this really quickly. I thought that using onRetainNonConfigurationInstance and getLastNonConfigurationInstance <http://reference/android/app/Activity.html#getLastNonConfigurationInstance%28%29> is enough to carry state from one configuration to the other (e.g. when sliding out keyboard or rotating phone). onSaveInstanceState is not necessary in this case, i thought.


--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to