I am trying to start a fragment in the activity by using the following method:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
getFragmentManager().beginTransaction()
.add(android.R.id.content, createFrag2()).commit(); //createFrag is a function that adds some values to the bundle and returns a fragment
What I was told was to be careful when using "android.R.id.content". I was told that if I use the fragment as the top level content view of the activity, then you can use. And if it's not a top level content view, then I will need to create a custom layout and setting it's ID.
So the question, what is a top level content view in Android? Is it the main/first layout in the XML? What is the relation to the root view?
I know that the setContentView function will set the activity's content to that of the view specified by the XML. But, I am trying to understand it from the perspective of that statement above("top level content view of the activity").
Thanks!