title: Store checkbox value to Firebase Database
body: <p>I'm making an app and I need to register user. I also have two checkboxes where the user selects gender (male or female). I know that checkbox understand boolean values true or false, but I'm wondering how to do that with firebase.
  This is exactly what I need to do:
  <a href="https://i.stack.imgur.com/1Ik8w.png" rel="nofollow noreferrer">image</a></p>
  
  <p>Here what I've done:</p>
  
  <pre><code>private void SignUp(final String firstName, final String lastName, final String email, final String password, final String checkMale, final String checkFemale) {
          mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
       @Override
       public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
            if(task.isSuccessful()) {
                 FirebaseUser user = mAuth.getCurrentUser();
                 assert user != null;
                 String userId =user.getUid();
  
                 reference = FirebaseDatabase.getInstance().getReference().child("Users").child(userId);
                 HashMap&lt;String, Object&gt; hashMap = new HashMap&lt;&gt;();
                 hashMap.put("id", userId);
                 hashMap.put("firstName", firstName);
                 hashMap.put("lastName", lastName);
                 hashMap.put("email", email.toLowerCase());
                 if(male.isChecked() &amp;&amp; female.isChecked()) {
                     hashMap.put("male", checkMale);
                     hashMap.put("female", checkFemale);
                 }
                 reference.setValue(hashMap).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
  
       @Override
       public void onComplete(@NonNull Task&lt;Void&gt; task) {
            if(task.isSuccessful()) {
                 pd.dismiss();
                 Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
                 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                 startActivity(intent);
                 Toast.makeText(RegisterActivity.this, "User Registered successfully", Toast.LENGTH_SHORT).show();
                 }
            }
       });
       } else {
            pd.dismiss();
            Toast.makeText(RegisterActivity.this, "You can't register with this email or password", Toast.LENGTH_SHORT).show();
               }
        }
     });
   }
  </code></pre>
  
  <p>Any help is appreciated.</p>