Suppose I have several fragments:

public class FirstFragment extends Fragment { ... }

public class SecondFragment extends Fragment { ... }

public class ThirdFragment extends Fragment { ... }

I have also a main activity, its content is (main.xml):

<LinearLayout ...>

  <!-- How to have a fragment placehold without specify which fragment show here? -->
  <fragment>

</LinearLayout>

My question is, in above layout file, how can I define a fragment placeholder without specify which fragment show here, and then in My Activity java code, inflate a proper fragment to the placeholder ?

Is it possible and how to do it?

Edit
Report