user7575308 user7575308 -4 years ago 133
Java Question

Find all match in firebase real time database

Hello please I need search in database in firebase all appearance with one parameter and write it on display or save in object. (if save in object I can process it)

My database looking

My data

And i need get all match mDatabaseReference.child("horse").child(kon.getUid()).child("plemeno") with "Hnedy"

and save somewhere. or process write on display and search second.

I don't know why...


If I need run over all database for search or it's simply here.

Please give me all advice I select best for me.

If you need more info please write, but I don't know how you need.

..I would not know what to say


for first I write on display all databse with thise code..

private void addEventFirebaseListener() {

mDatabaseReference.child("horse").addValueEventListener(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
if(list_kone.size() > 0)
for(DataSnapshot postSnapshot:dataSnapshot.getChildren()){
Kon kon = postSnapshot.getValue(Kon.class);
ListViewAdapter adapter = new ListViewAdapter(All.this,list_kone);


public void onCancelled(DatabaseError databaseError) {


but I thing so it's no important for search

Answer Source

Try this:

mDatabaseReference.child("horse").orderByChild("plemeno").equalTo("Hnedy").addListenerForSingleValueEvent(new ValueEventListener() {
        public void onDataChange(DataSnapshot dataSnapshot) { 
            // retrieve the data into an object: yourDataObject here
            if (cenaFilter && yourDataObject.getCena().equals("100")) {
               // RETRIEVE DATA

        public void onCancelled(FirebaseError firebaseError) {


Here cenaFilter is a boolean which equals to true if the user has selected this specific filter, false otherwise

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download