D
D
Danil2017-06-04 17:20:53
Java
Danil, 2017-06-04 17:20:53

How to search data in Firebase and display search result?

Hello. I need to do this, enter email in the field, search the database in Firebase, if the entered email is found, a message is displayed.
Structure
3bc12d35df9743fcbd93fee251ec4f18.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil, 2017-06-04
@Nikop

Okay, I solved it like this:

mDatabaseLinked.orderByChild("Email").equalTo(email).addChildEventListener(new ChildEventListener() {
                @Override
                public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                    
                    String name = dataSnapshot.child("Name").getValue(String.class);
                    Toast.makeText(getActivity(), "Заявка на рассмотрении, " + name, Toast.LENGTH_LONG).show();

                }
});

The question is, the data was found in the database, how to handle errors? Like null

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question