Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. mAuth.signInWithEmailAndPassword(emailInp, passInp).addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
  2.                         @Override
  3.                         public void onComplete(@NonNull Task<AuthResult> task) {
  4.                             FirebaseUser currentUser = mAuth.getCurrentUser();
  5.                             //if login succeed
  6.                             if (currentUser != null) {
  7.                                 Intent main = new Intent(LoginActivity.this, MainActivity.class);
  8.                                 Bundle b = new Bundle();
  9.                                 b.putString("email", emailInp);
  10.                                 main.putExtras(b);
  11.                                 mAuth.getCurrentUser();
  12.                                 startActivity(main);
  13.                             } else
  14.                                 //when the login check is failed
  15.                                 Toast.makeText(LoginActivity.this, "Incorrect Email or Password", Toast.LENGTH_SHORT).show();
  16.                         }
  17.                     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement