EDIT: Solved
I am struggling with this issue for a couple of hours and couldn't find any solution that worked for me.
So, my application crashes when I press the Send
button. The firebase stuff is working fine, but when I want to display a toast message the app crashes --> excluded the stuff I wanted to do to an Activity but still crashing.
So, what can I do, that the method doSomeStuff
is called correctly?
This is the method in the Sign_In Activity:
public void doSomeStuff() {
active_user = "test";
}
This is the AppCompatDialogFragment:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Pop_Up_Theme);
LayoutInflater inflater = getActivity().getLayoutInflater();
view = inflater.inflate(R.layout.pop_up_dialog, null);
firebaseAuth = FirebaseAuth.getInstance();
Email = view.findViewById(R.id.EmailInput);
Email.setText(Loading.email);
builder.setView(view)
.setCancelable(false)
.setPositiveButton("Send", new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialogInterface, int i) {
String email = Email.getText().toString().trim();
firebaseAuth.sendPasswordResetEmail(email)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Sign_In.doSomeStuff();
dialogInterface.cancel();
} else {
//Secret stuff ;)
}
}
});
}
});
return builder.create();
}