Guest User

Untitled

a guest
Apr 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. public void loadUserInformation() {
  2. final String mNumber = getActivity().getIntent().getStringExtra("Phone_Number");
  3. DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
  4. DatabaseReference usesrRef = rootRef.child("Users").child(uid);
  5. ValueEventListener eventListener = new ValueEventListener() {
  6. @Override
  7. public void onDataChange(DataSnapshot dataSnapshot) {
  8. EditText Name = (EditText) rootView.findViewById(R.id.Name);
  9. ImageView profilePic = (ImageView)rootView.findViewById(R.id.profilePic);
  10. for(DataSnapshot postSnapshot: dataSnapshot.getChildren()){
  11. String name=postSnapshot.child("Name").getValue().toString();
  12. String email=postSnapshot.child("Email").getValue().toString();
  13. String status=postSnapshot.child("Status").getValue().toString();
  14. String quote=postSnapshot.child("Quote").getValue().toString();
  15. String number = postSnapshot.child("Phone_Number").getValue().toString();
  16. String image = dataSnapshot.child("Image").getValue().toString();
  17.  
  18. Name.setText(name);
  19. Email.setText(email);
  20. Status.setText(status);
  21. Quote.setText(quote);
  22. Number.setText(number);
  23.  
  24. Picasso.get().load(image).into(profilePic);
  25.  
  26. }
  27.  
  28. @Override
  29. public void onCancelled(DatabaseError databaseError) {
  30. Toast.makeText(getActivity(),"Error Loading UserDetails",Toast.LENGTH_LONG).show();
  31. }
  32. };
  33. usesrRef.addListenerForSingleValueEvent(eventListener);
  34. }
  35.  
  36. @Test
  37. public void givenNull_whenCreatesNullable_thenCorrect() {
  38. String name = null;
  39. Optional<String> opt = Optional.ofNullable(name);
  40. assertEquals("Optional.empty", opt.toString());
  41. }
  42.  
  43. String status=postSnapshot.hasChild("Status") ? postSnapshot.child("Status").getValue().toString() : 'NULL';
  44. String quote=postSnapshot.hasChild("Quote") ? postSnapshot.child("Quote").getValue().toString() : 'NULL';
Add Comment
Please, Sign In to add comment