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)
- at com.google.android.gms.tasks.zzc$1.run(Unknown Source)
- at android.os.Handler.handleCallback(Handler.java:725)
- at android.os.Handler.dispatchMessage(Handler.java:92)
- at android.os.Looper.loop(Looper.java:137)
- at android.app.ActivityThread.main(ActivityThread.java:5069)
- at java.lang.reflect.Method.invokeNative(Native Method)
- at java.lang.reflect.Method.invoke(Method.java:511)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
- at dalvik.system.NativeStart.main(Native Method)"
- 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