I have the following database in firebase
Now I want to bring the titles of the cities depending on their zone number
I tried to bring the data and put it in a TextView but so far it shows nothing
DatabaseReference myRef = FirebaseDatabase.getInstance().getReference();
Query query = myRef.child("cities");
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
for (DataSnapshot citi : dataSnapshot.getChildren()) {
txt.setText(citi.getValue().toString());
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});