Search data in node firebase

Viewed 24

This is my firebase database This is my firebase database

 fAuth = FirebaseAuth.getInstance();
    refe = FirebaseDatabase.getInstance().getReference().child(fAuth.getCurrentUser().getUid()).child("Reminder");

 private void searchproduct(String title) {

    Query query= refe.orderByChild("title").equalTo(title);
    query.addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {

            if(dataSnapshot.exists())
            {
                ArrayList<String>listproduct= new ArrayList<>();
                for (DataSnapshot ds:dataSnapshot.getChildren())
                {

                    Product product= new Product(ds.child("title").getValue(String.class),ds.child("des").getValue(String.class),ds.child("date1").getValue(String.class));
                    listproduct.add(product.getTitle()+"\n"+ product.getDes()+"\n"+ product.getDate1());
                }
                ArrayAdapter adapter = new ArrayAdapter(getApplicationContext(),android.R.layout.simple_list_item_1,listproduct);
                listdata.setAdapter(adapter);
            }else{
                Log.d("Product","Data not found");
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });
}

When i run the code the query not working, the search did not do anything. I hope someone can give me solution. I have try many example here but not working

0 Answers
Related