How to Search for data in Firebase Android

前端 未结 2 1079
臣服心动
臣服心动 2020-12-16 07:02

\"FireBase

I want to search a condition if user says MSCS,then Search should check -> conditi

相关标签:
2条回答
  • 2020-12-16 07:41

    Sounds that you are looking for something like the following.

    mDatabase.orderByChild("MSCS").equalTo(1).addListenerForSingleValueEvent(
        new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                //data will be available on dataSnapshot.getValue();
            }
    
            @Override
            public void onCancelled(DatabaseError databaseError) {
                Log.w(TAG, "getUser:onCancelled", databaseError.toException());
            }
    });
    

    Let me know if this works for you :)

    0 讨论(0)
  • 2020-12-16 07:50

    Firebase equalTo(String value) method only returns value if it matches exactly. It is not like SQL LIKE query

    0 讨论(0)
提交回复
热议问题