List objects by neighborhoods

Asked

Viewed 58 times

0

I have an object where it is possible to add a list of addresses in the address field, the goal is to list the objects according to the neighborhoods where the objects reside.

Object:

public class Suspeito implements Serializable {

private String id;
private String foto;
private String nome;
private String apelido;
private String data_nascimento;
private String num_documento;
private String tipo_documento;
private String mae;
private String pai;
private String antecedentes;
private ArrayList<Endereco> endereco;
private String anotacoes;
}

Query:

 consulta = firebaseReferencia.child("Suspeitos").child("endereco")
                .orderByChild("bairro")
                .equalTo(txt_bairro.getText().toString().toUpperCase());

The query is returning null.

JSON object firebase: firebase

  • Try .child("Suspeitos").orderByChild("endereco/bairro")

  • I tried to .child("Suspeitos").orderByChild("endereco/0/bairro") and returns the expected results based on this node, however how can I check the other address nodes?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.