Many of the API demos use this -- for example the stack and layout demos.
 You can look at those and see what you are doing differently.

On Thu, Mar 24, 2011 at 10:37 AM, jotobjects <[email protected]> wrote:

> I can remove and add fragments, but replace doesn't cause the new
> Fragment to show up.
>
> The API docs are a little unclear about which existing Fragment would
> be replaced.
>
> On Mar 23, 4:49 pm, jotobjects <[email protected]> wrote:
> > Having a bit of a go with Fragments and hitting a snag.  My layout
> > looks like this.  The objective is to add a Fragment to the
> > LinearLayout.
> >
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >     android:id="@+id/foobar"
> >     android:layout_width="fill_parent"
> >     android:layout_height="wrap_content"
> >     android:orientation="vertical"
> > />
> >
> > First I do this - which works fine to add and display the Fragment
> > into the layout container
> >
> > Fragment f1 = new FragmentOne();
> > fragmentManager.beginTransaction().add(R.id.foobar, f1,
> > "ABC").commit();
> >
> > later on I want to replace that Fragment with a different one so I do
> > this -
> >
> > Fragment f2 = new FragmentTwo();
> > fragmentManager.beginTransaction().replace(R.id.foobar, f2,
> > "DEF").commit();
> >
> > But Fragment f1 is still there in the View. What part of this is am I
> > doing incorrectly?
>
> --
> 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