我已经完成了在用户节点下使用firebase电子邮件身份验证创建的uid的插入,但我想编辑和更新个人详细信息,然后我检索出错。登录后,我的代码无法检索特定的用户数据。如果有人有解决方案,请告诉我。感谢。
那么我将如何检索特定数据并进行更新呢?
private EditText ppw, ppn, pa, ppc;
private TextView un, page;
private Button pbt;
private FirebaseDatabase db;
private DatabaseReference dref;
private FirebaseUser ur;
private FirebaseAuth auth;
private String uid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_personal_profile);
db = FirebaseDatabase.getInstance();
dref = db.getReference("users");
//ur = auth.getCurrentUser();
//uid = ur.getUid();
un = (TextView) findViewById(R.id.Pun);
ppw = (EditText) findViewById(R.id.Ppw);
page = (TextView) findViewById(R.id.Page);
ppn = (EditText) findViewById(R.id.Ppn);
pa = (EditText) findViewById(R.id.Pa);
ppc = (EditText) findViewById(R.id.Ppc);
pbt = (Button) findViewById(R.id.Psbt);
dref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String eun = dataSnapshot.child("username").getValue().toString();
un.setText(eun);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}