Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. "FATAL EXCEPTION: main
  2. java.lang.NullPointerException
  3. at com.example.ghost.prochat.MainActivity$1.onComplete(MainActivity.java:134)"
  4.  
  5. FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
  6. @Override
  7. public void onComplete(@NonNull Task<AuthResult> task) {
  8. Logger.getLogger(LoginActivity.class.getName()).log(Level.ALL, "createUserWithEmailAndPassword:onComplete:" + task.isSuccessful());
  9. registerProgressDlg.dismiss();
  10. if (!task.isSuccessful()) {
  11. Logger.getLogger(MainActivity.class.getName()).log(Level.ALL, "createUserWithEmailAndPassword", task.getException());
  12. Utils.showDialog(
  13. MainActivity.this,
  14. getString(R.string.err_singup));
  15. }
  16. else {
  17. final ArrayList<String> defaultRoom = new ArrayList<String>();
  18. defaultRoom.add("home");
  19. // Update the user profile information
  20. final FirebaseUser user = task.getResult().getUser();
  21. UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
  22. .setDisplayName(String.valueOf(displayUsername))
  23. .setPhotoUri(Uri.parse("https://example.com/jane-q-user/profile.jpg"))
  24. .build();
  25. user.updateProfile(profileUpdates).addOnCompleteListener(new OnCompleteListener<Void>() {
  26. @Override
  27. public void onComplete(@NonNull Task<Void> task) {
  28. if (task.isSuccessful()) {
  29. Logger.getLogger(MainActivity.class.getName()).log(Level.ALL, "User profile updated.");
  30. // Construct the ChatUser
  31. UserList.user = new ChatUser(user.getUid(),displayUsername, editTextEmail,true,defaultRoom);
  32. // Setup link to users database
  33. FirebaseDatabase.getInstance().getReference("users").child(user.getUid()).setValue(UserList.user);
  34. startActivity(new Intent(MainActivity.this, UserList.class));
  35. finish();
  36. }
  37. }
  38. });
  39. }
  40. }
  41. });
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement