title: How to add data to Realtime Database?
body: <p>I'm just wanna create an account with some data. Unfortunately, I do not know where the error is, and during registration, the account is created but the data is not saved in the Realtime Database.</p>
  <pre><code>mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(task -&gt; {
      if (task.isSuccessful()) {
          FirebaseUser user = mAuth.getCurrentUser();
          reference = FirebaseDatabase.getInstance().getReference(&quot;Users&quot;).child(user.getUid());
  
          HashMap&lt;String, Object&gt; hashMap = new HashMap&lt;&gt;();
          hashMap.put(&quot;username&quot;, username);
          hashMap.put(&quot;email&quot;, email);
          hashMap.put(&quot;id&quot;, user.getUid());
          hashMap.put(&quot;imageURL&quot;, &quot;default&quot;);
          hashMap.put(&quot;status&quot;, &quot;offline&quot;);
  
          reference.setValue(hashMap).addOnCompleteListener(task1 -&gt; {
              if (task1.isSuccessful()) {
                  Toast.makeText(RegisterActivity.this, &quot;Registered Successfully&quot;, Toast.LENGTH_SHORT).show();
                  startActivity(new Intent(RegisterActivity.this, StartActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
              }else{
                  Toast.makeText(RegisterActivity.this, &quot;Registered Failed&quot;, Toast.LENGTH_SHORT).show();
              }
          });
      }
  });
  </code></pre>