My data structure is like this and what I want to do is to get value from different node.
root
|__data__people___name1:...
| |_name2:...
| |_name3:...
| ...
|_location__latitude:...
|_longitude:...
Now I want to get location's value (LatLng that is saved earlier) when people's child is added. But what I know is to get the value that is added. Is there a way to refer to different node value?
data.child("people").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
//get location's value here
}
}
Also, could you kindly tell me how to get LatLng
from database and assign it to LatLng
?