On Fri, Aug 12, 2011 at 2:57 PM, Ian <[email protected]> wrote:
> When you say "create a no-UI fragment"

I haven't tried this technique, personally. My state tends to be bound
up in fragments that need an actual UI, or is part of a data model
that isn't "instance state". Hence, take my advice here with a
decent-sized grain of salt (or salt substitute, if you are on a
low-sodium diet).

> do you mean that there needs to be a
> <fragment/> element in my layout with the name of a no-UI fragment?

That's one possibility.

> Can I create it in my FragmentActivity's onCreate()?

That's another possibility.

> If so, what do I add it to to
> keep it from getting garbage collected outside of the onCreate()?

Well, in either case (<fragment> or a FragmentTransaction in
onCreate()), you would call setRetainInstance(true) on the fragment
itself. This tells Android to hold onto that fragment instance across
configuration changes.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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