Reputation: 49
I am working on a navigation drawer and am currently using:
getSupportFragmentManager().beginTransaction().replace(R.id.mainfragment, f1).commit();
but as you can see that always replaces the main fragment with the new one. Thanks!
Upvotes: 2
Views: 1537
Reputation: 6392
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(getId(), new SearchVideoDownloadFragment(), "NewFragmentTag");
ft.commit();
Upvotes: 1
Reputation: 619
You can do beginTransaction().replace (container, newFragment, tag), where container is the id of a ViewGroup in an xml file. So the thing being replaced is whichever fragment is currently in the container.
Upvotes: 1