每当我将其更改为user.getEmail()
而不是user.getUid()
时,应用程序崩溃。有谁知道背后的原因?
private void saveUserInformation() {
String name = editTextName.getText().toString().trim();
String team = editTextTeam.getText().toString().trim();
String pos = editTextPos.getText().toString().trim();
UserInformation userInformation = new UserInformation(name, team, pos);
FirebaseUser user = firebaseAuth.getCurrentUser();
databaseReference.child(user.getUid()).setValue(userInformation);
Toast.makeText(this, "Information saved", Toast.LENGTH_LONG).show();
}
以下是我的Firebase数据库结构。
`{ "K05L8cmiqdg3jZapHbhpz219hpG3" : {
},"RmJ1ZfgxmqQ4bENGWCr8Y1dIwO12" : {
} "pHX5yYjzPYTZB0ek3ijeoH7rafD3" : {
}}