I have two fragments as SignInFragment
and SignUpFragment
. First MainActivity
calls SignInFragment
with this code.
//MainActivity
if (savedInstanceState == null) {
signInFragment = new SignInFragment();
signUpFragment = new SignUpFragment();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.frame_holder,signInFragment);
fragmentTransaction.commit();
}
How can I call SignUpFragment
after clicking a sign-up button in SignInFragment
. I have got a reference to the button:
//SignInFragment
Button buttonSignUp = view.findViewById(R.id.button_sign_up);