'Firebase android studio not inserting data correctly

This is the data being inserted the the correct one is the [email protected] while the incorrectly inserted ones are the ones with a:Name

  mAuth.createUserWithEmailAndPassword(email, pass)
                    .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if(task.isSuccessful()) {
                                Teachers teachers = new Teachers(user, pass, email);

                                FirebaseDatabase.getInstance().getReference("Teachers")
                                        .child(FirebaseAuth.getInstance().getCurrentUser().getUid()).setValue(teachers).addOnCompleteListener(new OnCompleteListener<Void>() {
                                    @Override
                                    public void onComplete(@NonNull Task<Void> task) {

                                        if(task.isSuccessful()) {
                                            Toast.makeText(RegisterTeacher.this, "Teacher has been registered!", Toast.LENGTH_SHORT).show();

                                            Intent i = new Intent(RegisterTeacher.this, TeacherLogin.class);

                                            startActivity(i);
                                        }
                                        else {
                                            Toast.makeText(RegisterTeacher.this, "Failed to register!", Toast.LENGTH_SHORT).show();
                                        }

                                    }
                                });
                            } else {
                                Toast.makeText(RegisterTeacher.this, "Failed to register! Try again!", Toast.LENGTH_SHORT).show();
                            }
                        }
                    });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source