Skip to content Skip to sidebar Skip to footer

How Can I Get Some Value From My Firebase?

I am trying to solve how to get a value from my DatabaseReference, but doing so gives me the full address when I want to put it in a TextView This is the reference: public static

Solution 1:

         DatabaseReference database =  FirebaseDatabase.getInstance().getReference().child("nom_usuaios").getRef();
         database.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                // here you will the value in datasnapshot
               for (DataSnapshot dataSnapshot : dataSnapshot.getChildren()) {
                    list.add(dataSnapshot.getValue());
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        });

Post a Comment for "How Can I Get Some Value From My Firebase?"