Osama Mohammed
Osama Mohammed

Reputation: 2861

search data from Firebase in Android

please i am trying to search the all column that (dcountry ="France") as example, as illustrated in picture: enter image description here

i try that code, but not work:

 MyFirebase.db.child("Developer").orderByChild("dcountry")
            .startAt("France")
            .endAt("France"+ "\ufbff")
            .addValueEventListener(object:ValueEventListener{

        override fun onDataChange(p0: DataSnapshot?) {

Upvotes: 2

Views: 1203

Answers (2)

mirza furqaan
mirza furqaan

Reputation: 41

I have written query using kotlin. But it will help you

    val query = FirebaseDatabase.getInstance()
        .getReference()  
        .child("Developers")  
        .orderByChild("dcountry")
        .equalTo("france")
        .limitToFirst(50)

Upvotes: 0

Peter Haddad
Peter Haddad

Reputation: 80914

You can do this:

MyFirebase.db.child("Developers").orderByChild("dcountry").equalTo("France").addValueEventListener(object:ValueEventListener{

which will give you all countries that are equal to france

Upvotes: 4

Related Questions