Friday, August 12, 2011

Re: [android-developers] Android CL and onRetainNonConfigurationInstance

Mark,

On Tuesday, July 19, 2011 7:45:43 AM UTC-5, Mark Murphy (a Commons Guy) wrote:
On Tue, Jul 19, 2011 at 5:32 AM, Zsolt Vasvari <zvas...@gmail.com> wrote:

> If so,
> what can I do when I have some objects I need to retain, but I cannot
> save them to the activity state?  In particular, I have running tasks
> I need to connect my activities to.

If the running tasks or other objects more properly belong to a
fragment, have the fragment manage them and use setRetainInstance() to
keep those fragment instances between configuration changes.

Otherwise, I think the expectation is that you create a no-UI fragment
that manages those objects, which is part of your activity and on
which you use setRetainInstance().

When you say "create a no-UI fragment", do you mean that there needs to be a <fragment/> element in my layout with the name of a no-UI fragment? Can I create it in my FragmentActivity's onCreate()? If so, what do I add it to to keep it from getting garbage collected outside of the onCreate()?

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment