[Solved] How to get a specific given in Firebase [closed]


First of all initiate the database instance

FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();

get the reference of your DB where you want to perform the operation

DatabaseReference dbRef = firebaseDatabase.getReference(NAME_OF_DATABASE);

then use this to get all the user with the name equal to the editText text

Query query = profileDbRef
            .orderByChild("name")
            .equalTo(edittext.getText().toString());
    query.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
                Log.d(TAG, dataSnapshot1.getKey() + "  " + dataSnapshot1.getValue(Profile.class)
                        .toString());
               }
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

5

solved How to get a specific given in Firebase [closed]