I think that firebaseAuth.getCurrentUser().getUid() return uid that is not the same as uid in FirebaseDatabase. You can user Query.
For example:
Query q = firebaseDatabase.child("users").orderByChild("email").equalTo(firebaseAuth.getCurrentUser().getEmail());
You should use addChildEventListener
instead of addValueEventListener
, and write the code inside onChildAdded
.
You can find the explanation fromdocumentation :
When working with lists, your application should listen for child events rather than the value events used for single objects.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.