Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. FirebaseDatabase database = FirebaseDatabase.getInstance();
  2. DatabaseReference myRef = database.getReference("message");
  3. myRef.addValueEventListener(new ValueEventListener() {
  4. @Override
  5. public void onDataChange(DataSnapshot dataSnapshot) {
  6. // This method is called once with the initial value and again
  7. // whenever data at this location is updated.
  8. User user = dataSnapshot.getValue(User.class);
  9. if (user != null) {
  10. value.setText(user.getNom());
  11. }
  12. }
  13.  
  14. @Override
  15. public void onCancelled(DatabaseError error) {
  16. // Failed to read value
  17. Log.w(TAG, "Failed to read value.", error.toException());
  18. }
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement