I know there are already some questions about it, but none of the answers work out for me.
I want to pass the String inputEmail from StartFragment to SignInFragment.
I tried to do this with the bundle:
StartFragment
SignInFragment fragmentTwo = new SignInFragment();
Bundle bundle = new Bundle();
bundle.putString("key", input_mail);
fragmentTwo.setArguments(bundle);
SignInFragment:
View view = inflater.inflate(R.layout.fragment_sign_in, container, false);
Bundle bundle = getArguments();
if (bundle!=null) {
String mail = bundle.getString("key");
}
else {
Toast.makeText(getActivity(), "key not found", Toast.LENGTH_SHORT).show();
}
return view;
I have already found out that the problem is that the key couldn´t be found and that is the reason why app crashes all the time. So i put an if clause in in order to fix it but I still dont get the String inputEmail.
So how can I pass the String inputMail from StartFragment SignInFragment
Thank u in advance