On Wed, Apr 27, 2011 at 9:46 AM, Dave Johnston <[email protected]> wrote:
> What is the correct way to pass arguments to a Fragment after
> inflation (for example, after calling setContentView)? Attempting to
> call setArguments() after setContentView() results in
> "java.lang.IllegalStateException: Fragment already active".
>
> Is it simply preferable to instantiate and add Fragments via code,
> rather than use fragment inflation from an XML layout?

I don't think there is necessarily a "preferable" or not. Arguments
are not mandatory.

You might take a peek at onInflate() on Fragment. It hints at creating
your own attributes that get copied into the arguments bundle.

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

_The Busy Coder's Guide to *Advanced* Android Development_ Version
1.9.3 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