If I log data to the database... I have the following eference:
DatabaseReference crearUsuario = databaseRef.child(Usuarios).push();
crearUsuario.child("nombre").setValue("Tony");
crearUsuario.child("email").setValue("[email protected]");
crearUsuario.child("tel").setValue("123456789");
To locate this user I do the following:
databaseRef.child(Usuarios).orderBychild("email").equalTo("[email protected]").addValueEventListener...
But if I want to get the value of the "name", how do I do it if I don't know the folder (child) that the push method generated?
When performing the push you will have generated a record similar to this:
If you save the key (createUser.getKey()) you could access it like this:
However, with the query that you are performing, as you say, you access the user and from there you can obtain their children's name, email and phone:
[Resolved]: Instead of
It is
So...
I think the problem was that 'addValueEventListener...' listened to all the possible 'Users' and did not return the values of one in particular.
On the contrary, 'addChildEventListener()...' returns the values of a single 'User'.