I have an application where user registration with name,password,email and current address.But i only know how to registration with email and password. Now i need to registration with name,password,email,currentAddress. Is it possible? And what type of difference between difference between create user with email password and Create user with credential in firebase ? I do the following:
final String password = mPassword.getText().toString();
// final String name = mName.getText().toString();
final String email = mEmail.getText().toString();
//final String currentAddress = mCurrentAddress.getText().toString();
mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(DriverLoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Toast.makeText(DriverLoginActivity.this, "Signup error", Toast.LENGTH_SHORT).show();
} else {
String user_id = mAuth.getCurrentUser().getUid();
DatabaseReference current_user_db = FirebaseDatabase.getInstance().getReference().child("Users").child("drivers").child(user_id).child("name");
current_user_db.setValue(email);
}
}
});
It's my error report:
java.lang.NullPointerException at com.example.raifu.mapforinto.DriverLoginActivity$2.onClick(DriverLoginActivity.java:60) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5019)