I am making a list, and in this list I pull the following information id, idPost, description, userName and photoUser.
But to popular (add) data to this list I'm using the following code snippet inside an activity:
itensSalvosRef = ConfiguracaoFirebase.getFirebase().child("itens-salvos").child(idUsuarioLogado);
@Override
protected void onStart() {
super.onStart();
listarItensSalvos();
}
private void listarItensSalvos() {
valueEventListener = itensSalvosRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
listaItemSalvo.clear();
for (DataSnapshot ds : dataSnapshot.getChildren()) {
listaItemSalvo.add(ds.getValue(ItemSalvo.class));
}
Collections.reverse(listaItemSalvo);
itensSalvosAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
Firebase structure:
Theideaisthatitretrievesallvalues,butitonlyretrievestheuserName,asshowninthepicturebelow:
What am I doing wrong to the popular (add values) to this list?