Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "FATAL EXCEPTION: main
- java.lang.NullPointerException
- at com.example.ghost.prochat.MainActivity$1.onComplete(MainActivity.java:134)"
- FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
- @Override
- public void onComplete(@NonNull Task<AuthResult> task) {
- Logger.getLogger(LoginActivity.class.getName()).log(Level.ALL, "createUserWithEmailAndPassword:onComplete:" + task.isSuccessful());
- registerProgressDlg.dismiss();
- if (!task.isSuccessful()) {
- Logger.getLogger(MainActivity.class.getName()).log(Level.ALL, "createUserWithEmailAndPassword", task.getException());
- Utils.showDialog(
- MainActivity.this,
- getString(R.string.err_singup));
- }
- else {
- final ArrayList<String> defaultRoom = new ArrayList<String>();
- defaultRoom.add("home");
- // Update the user profile information
- final FirebaseUser user = task.getResult().getUser();
- UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
- .setDisplayName(String.valueOf(displayUsername))
- .setPhotoUri(Uri.parse("https://example.com/jane-q-user/profile.jpg"))
- .build();
- user.updateProfile(profileUpdates).addOnCompleteListener(new OnCompleteListener<Void>() {
- @Override
- public void onComplete(@NonNull Task<Void> task) {
- if (task.isSuccessful()) {
- Logger.getLogger(MainActivity.class.getName()).log(Level.ALL, "User profile updated.");
- // Construct the ChatUser
- UserList.user = new ChatUser(user.getUid(),displayUsername, editTextEmail,true,defaultRoom);
- // Setup link to users database
- FirebaseDatabase.getInstance().getReference("users").child(user.getUid()).setValue(UserList.user);
- startActivity(new Intent(MainActivity.this, UserList.class));
- finish();
- }
- }
- });
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement