Reality
Reality

Reputation: 17

How to fetch the specific data from the firebase

I want to fetch the specific data from the firebase into the android app.

I want to be fetch only that data where ar="Atif Aslam". How I can do that? This is my database

enter image description here

Upvotes: 0

Views: 108

Answers (2)

Benjith Mathew
Benjith Mathew

Reputation: 1221

Try using firebase.database.Query

Query msgQuery = childRef.orderByChild("ar").equalTo("Atif Aslam");
msgQuery.addChildEventListener(MainActivity.this);

Upvotes: 1

Akshay
Akshay

Reputation: 1161

try the following code:

DatabaseReference mDatabaseReference = FirebaseDatabase.getInstance().getReference("uploads");    
Query query
    =  mDatabaseReference.orderByChild("ar").equalTo("Atif Aslam");

refer examples from firebase official site:https://firebase.google.com/docs/reference/android/com/google/firebase/database/Query

Hope this helps.

Upvotes: 1

Related Questions