Good morning! I have a situation in which I want to return a list of all the data whose children are equal to the id, in the image below I have the structures of the nodes of my bank in firebase and I want to return, for example, the number of all the activities which one of the nodes (idUsuario) is the same as the logged in user (in case I used an encryption form to store the id of the user and the id I can recover normally), to improve, in a relational database would look something like this: select * from activities where idUsuario="A" for example;
Well,tosolvethisproblemIchangedthestructureIwasusingtosavethedatainfirebasesothatitwouldlooklikethis:
This way I can more easily bring the data that is tied to the specified user:
//Evento de consulta
valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//LIMPANDO A LISTA
atividadeArrayList.clear();
//Listando cada uma das atividades criadas pelo usuário
for (DataSnapshot dados: dataSnapshot.getChildren()){ //recupera os filhos do nó principal
Atividade atividade = dados.getValue(Atividade.class);
atividadeArrayList.add(atividade);
}
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
But thank you Matheus for your help!