android - Why am I not getting value of child value from Firebase? -
i want value of uid firebase database, looks that:
and below code value
mpostkey=getintent().getextras().getstring("profile_id"); mdatabase= firebasedatabase.getinstance().getreference().child("profiles").child(mpostkey).child("uid"); mdatabase.addlistenerforsinglevalueevent(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { muid=datasnapshot.getvalue().tostring(); } @override public void oncancelled(databaseerror databaseerror) { } });
and debugger showing these values
i'm pointing uid correctly i'm unable value, keep on getting null in muid.
you need change line of code:
muid=datasnapshot.getvalue().tostring();
with
string muid=datasnapshot.getvalue(string.class);
add line of code after above declaration verify if works:
log.d("tag", muid);
Comments
Post a Comment