I am building an app that will be able to let you answer assessment questions. Now I have a problem on how to save the scores to the current user. I cannot access the child node. This is the real time database. How can I access the child node under Users
Asked
Active
Viewed 599 times
1 Answers
0
You can simply use for loop to access the users just write this code under addOnEventListener:
DataSnapshot Users = datasnapshot.child("Users");
for(DataSnapshot userChild : Users.getChildren()){
DataSnapshot email = userChild.child("email");
String emailString = email.getValue(String.class);
}

Pratham Khurana
- 141
- 1
- 12
-
what should i put inside the for loop? – Rona Cecilia Abayata Sep 29 '18 at 12:58
-
how can i access the users? – Rona Cecilia Abayata Sep 29 '18 at 14:42
-
You should get the values of you user i.e., email ,password and username. By accessing the children using userChild.child("username").getValue() to string – Pratham Khurana Sep 29 '18 at 14:46
-
its still not working. pls help me – Rona Cecilia Abayata Sep 29 '18 at 15:59
-
Can you update the code!! – Pratham Khurana Sep 29 '18 at 15:59
-
I update the ans use this to get the email and other stuff – Pratham Khurana Sep 29 '18 at 16:01