Open Fragment From Another Fragment?
is it possible to open a fragment B from fragment A by tapping on a button in fragment A? Both fragments are part of a main FragmentActivity. How can I handle that? EDIT: The Tabs
Solution 1:
Add below code to onClick():
public void onClick(View v) {
Fragment fragment = new projectInformationFragment();
FragmentTransaction transaction =
getActivity().getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.nav_host_fragment, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
Post a Comment for "Open Fragment From Another Fragment?"