I\'m try to populate listview with all messages of all users of my Android app, but, I got it populate listview with only one user messages because I\'m inserting messages infor
database.child("usuario").addValueEventListener(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot: dataSnapshot.getChildren()) {
for (DataSnapshot messageSnapshot: snapshot.child("mensagem").getChildren()) {
listView.add(messageSnapshot.child("textoMensagem").getValue().toString());
}
}
}
...
As you can see I add a ValueEventListener
to retrieve all children nodes of "usuario" and then loop through its children to get to your messages.
Tip: Think about (at least) posting your code/database structure etc. in English, it could make reading your question a lot easier.