I'm asking this Question After Reading Official Docs. I managed to register user on my Firebase Authentication System but I want to start an Activity after successful Signup
here is my code
public class SignUpActivity extends AppCompatActivity {
FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
mAuth=FirebaseAuth.getInstance();
}
public void fgh(View view) {
mAuth.createUserWithEmailAndPassword("[email protected]","password")
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful())
{
Toast.makeText(SignUpActivity.this, "Successfully created your account", Toast.LENGTH_LONG).show();
Intent intent = new Intent(this,SuccessActivity.class); //this is my error
startActivity(intent); // how to start activity here
}
else{
Toast.makeText(SignUpActivity.this, "ERROR has occurred", Toast.LENGTH_LONG).show();
}
}
});
}
}
get the context right so let it be
Intent intent = new Intent(SignUpActivity.this,SuccessActivity.class);