I am learning fragments but I am failing to understand the significance behind why fragments requires a Container.

The way I understand Fragments work is as follows :

  1. FragmentActivity setContentview refers to a xml file which defines where fragments would be located.

  2. FragmentActivity creates instance of the fragments

  3. Then assigns fragment to container.

  4. FragmentManager then displays them.

  5. The actual Fragment class then inflates a layout, and it is this layout which contains all of the applications UI components.

(please correct me if I miss something here because I am only learning at the moment).

So why is the purpose of the Container why do we even need since in all the examples I have seen it is just a blank relative layout xml document.

Can different fragments share the same Container (since its just a RelativeLayout xml file)?

So in the example provided by google http://developer.android.com/training/basics/fragments/creating.html

They have a ListFragment and when item is selected through the use of the CallBack interface we eventually get back to this line of code :

// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack so the user can navigate back
transaction.replace(R.id.fragment_container, newFragment);

My other question is:

1) Why does this line of code not replace the ListFragment (left side Fragment) with the article fragment. Since when it was initialised we see:

getSupportFragmentManager().beginTransaction()
                    .add(R.id.fragment_container, firstFragment).commit();

Instead ... the ListFragment remains on the left and the right Fragment is updated. But the container fragme

Edit
Report