How to search for a value in firebase Android

前端 未结 7 1837
孤城傲影
孤城傲影 2020-12-01 05:37

I am saving data as follows in the Firebase:

I want to find all records that have #Yahoo in their title. What will be the exact query for that?

I am

7条回答
  •  半阙折子戏
    2020-12-01 06:29

        DatabaseReference mDatabase =FirebaseDatabase.getInstance().getReference("userTasks");
        mDatabase.orderByChild("title").equalTo("#Yahoo").addListenerForSingleValueEvent(new ValueEventListener() {
                   @Override
                   public void onDataChange(DataSnapshot dataSnapshot) {
        for (DataSnapshot snapshot: dataSnapshot.getChildren()) {
           ///Here you can get all data 
        }
        @Override
         public void onCancelled(DatabaseError databaseError) {}
    });
    

提交回复
热议问题