title: Unable to add data to Firebase database
body: <p>I have created a node with name <code>Users</code>. I want to create a child node with name of the <code>Uid</code> of the user that register himself and store his/her all profile info in that child node.</p>
  
  <p>It should happen only if user has been successfully registered to database. So I have used following code:</p>
  
  <pre><code>                        mAuth.createUserWithEmailAndPassword(user.getEmail(), password)
                                  .addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
                                      @Override
                                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                                          Log.d("MainActivity", "signIn:onComplete:" + task.isSuccessful());
  
                                          if (task.isSuccessful()) {
                                              DatabaseReference userDatabaseReference = FirebaseDatabase.getInstance().getReference().child("Users");
                                              userDatabaseReference.child(task.getResult().getUser().getUid())
                                                      .setValue(user).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                                                  @Override
                                                  public void onComplete(@NonNull Task&lt;Void&gt; task) {
                                                      Toast.makeText(ResetPassword.this, "user registred to database", Toast.LENGTH_SHORT).show();
                                                      Intent intent = new Intent(ResetPassword.this, MainActivity.class);
                                                      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                                      startActivity(intent);
                                                  }
                                              });
  
                                          } else {
                                              Toast.makeText(ResetPassword.this, "Registration Failed",
                                                      Toast.LENGTH_SHORT).show();
                                          }
                                      }
                                  });
  </code></pre>
  
  <p>But my code is not working. User is registered successfully, but no child is created in the database. Which should be created with the name of the Uid of the user.</p>
  
  <p>When I added breakpoints as shown here:</p>
  
  <p><img src="https://i.stack.imgur.com/xB5Kl.jpg" alt=""></p>
  
  <p>I found that compiler goes directly to line 106 after line no 82 without executing any line in between, but still it calls the MainActivity which is called inside on complete.</p>
  
  <p>I don't understand how is this happening. Thanks in advance.</p>