• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Get reference

Ratchoss

Newbie
Oct 24, 2017
17
0
Hello, so here, I would like to know how I could get the reference name from the email address firebase as on the image?

upload_2017-10-27_19-54-5.png


My code :

Java:
DatabaseReference mDatabaseReference;
mDatabaseReference = FirebaseDatabase.getInstance().getReference();

mDatabaseReference.child(How can it get the Ref name?).orderByChild("mail").equalTo(firebaseUser.getEmail()).addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                for (DataSnapshot child : dataSnapshot.getChildren()) {
                    name.clear();
                    name.add(child.getKey().toString());
                    String s = name.toString().replace("[", "").replace("\"", "").replace("]", "");

           

                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

If you have any question let me know, i'll answer them quickly! Thanks a lot.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones