Created
May 20, 2019 08:42
-
-
Save laxyapahuja/dba31a662e9c22e9372b50013a1f3cd0 to your computer and use it in GitHub Desktop.
Signing up accounts using Firebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void signUp(View view) { | |
EditText loginet=findViewById(R.id.email); | |
EditText passwordet=findViewById(R.id.password); | |
String email=loginet.getText().toString(); | |
String password=passwordet.getText().toString(); | |
mAuth.createUserWithEmailAndPassword(email, password) | |
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { | |
@Override | |
public void onComplete(@NonNull Task<AuthResult> task) { | |
if (task.isSuccessful()) { | |
// Sign in success, update UI with the signed-in user's information | |
FirebaseUser user = mAuth.getCurrentUser(); | |
Toast.makeText(getApplicationContext(),"Sign up successful.",Toast.LENGTH_LONG).show(); | |
startActivity(new Intent(MainActivity.this,AddTask.class)); | |
} else { | |
// If sign in fails, display a message to the user. | |
Toast.makeText(getApplicationContext(),"Sign up failed.",Toast.LENGTH_LONG).show(); | |
} | |
// ... | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment