我希望更新users
节点以及数据库中的presentUsersByPhoneNumber
节点。
但是,使用下面列出的代码时:
// Create in users table:
final Firebase usersRef = myFeastFirebaseNewUser.child("users");
Map<String, String> newUserAttributes = new HashMap<String, String>();
newUserAttributes.put("username", mUsername.getText().toString());
newUserAttributes.put("password", mPassword.getText().toString());
newUserAttributes.put("phoneNumber", mPhoneNum.getText().toString());
newUserAttributes.put("email", mEmail.getText().toString());
Map<String, Object> createNewUser = new HashMap<String, Object>();
createNewUser.put(result.get("uid").toString(), newUserAttributes);
usersRef.updateChildren(createNewUser);
// Create in presentUsersByPhoneNumber:
final Firebase userByPhoneNumber = myFeastFirebasePhoneSearch.child("presentUsersByPhoneNumber");
Map<String, String> newUserID = new HashMap<String, String>();
newUserID.put("uid", result.get("uid").toString());
Map<String, Object> createNewUsesPhoneRef = new HashMap<String, Object>();
createNewUser.put("1" + mPhoneNum.getText().toString(), newUserID);
userByPhoneNumber.updateChildren(createNewUsesPhoneRef);
结果是:
我希望做的是在保存时将节点presentUsersByPhoneNumber
设置为红色。
如何实现这一目标?
答案 0 :(得分:0)
Android代码应该是:
Map<String, Object> createNewUsesPhoneRef = new HashMap<String, Object>();
createNewUsesPhoneRef.put("1" + mPhoneNum.getText().toString(), newUserID);
userByPhoneNumber.updateChildren(createNewUsesPhoneRef);
不是对createNewUser