Correct you can't change the a fragment has been created, because unlike
activities it doesn't own the view but is given to a parent to incorporate
into its view hierarchy.

You can make your top-level view a FrameLayout and change the children
inside of it, though.

On Thu, Apr 28, 2011 at 2:54 PM, Erik <[email protected]> wrote:

> I have an Activity with different layouts for portrait and landscape.
> Since it has some complex state data I don't want to lose on rotation,
> I'm listening for rotation config changes. In onConfigurationChanged()
> I call setContentView() to rebuild the view hierarchy using the new
> layout.
>
> Now I'm converting the activity to use a Fragment. I want the Fragment
> to behave just like the Activity, rebuilding the view hierarchy with
> the new layout when it gets onConfigurationChanged(), but there
> doesn't seem to be any way to change a Fragment's view after it's been
> created. The only way seems to be to create a new Fragment, but then I
> lose all the state data from the original Fragment.
>
> Does anyone have any ideas on how to make this work?
>
> --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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