How to add fragments to activity programatically without XML



I have an activity without xml layout. Now I'm adding one fragment into activity by:



protected void onCreate(Bundle savedInstanceState) {
profileFragment = new ProfileFragment();
getSupportFragmentManager().beginTransaction().add(android.R.id.content, profileFragment).commit();
}


First thing is that I dont know what is R.id.content, because i didn't declare it, so where it is from?


Second, how could I add next 2 fragments into activity and place it where I want without xml layout for main activity (first fragment on top, and next 2 fragments side by side below first fragment)?


No comments:

Post a Comment