How can I retrieve values from Firebase database based on email entered by user in text field?

后端 未结 2 1647
小鲜肉
小鲜肉 2021-01-26 16:19

I am working on Firebase database. How can I retrieve values from database based on email entered by user in text field. Below is my database structure. Kindly help.

2条回答
  •  失恋的感觉
    2021-01-26 17:03

    Try this! here I am running for each loop to get each child.

    Ref.child("UserRegistration").child("email").addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
    
                    for (DataSnapshot snapshot:dataSnapshot.getChildren()){
                        user_reg user=dataSnapshot.getValue(user_reg.class);
                        System.out.println(user.email);
                    }
                }
    
                @Override
                public void onCancelled(DatabaseError databaseError) {
    
                }
            });
    

提交回复
热议问题