title: How to send multiple checkbox values to Firebase Database when a Button is clicked Android
body: <p>I want to send multiple checkbox values to Firebase database. I took three Checkboxes in XML and a Button. I want to store selected checkbox text to Firebase when the Button is clicked and go to another Activity. This is my code, but it isn't working.</p>
  
  <pre><code>    mFirstCheckBox = findViewById(R.id.firstCheckBox);
      mSecondCheckBox = findViewById(R.id.secondCheckBox);
      mThirdCheckBox = findViewById(R.id.thirdCheckBox);
  
      mDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
  
      mAuth = FirebaseAuth.getInstance();
  
      saveButton = findViewById(R.id.saveButton);
      saveButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              switch (view.getId()) {
  
                  case R.id.firstCheckBox:
                      if(mFirstCheckBox.isChecked()) {
  
                          String user_id = mAuth.getCurrentUser().getUid();
                          DatabaseReference current_user_db = mDatabase.child(user_id);
  
                          current_user_db.child("1").setValue("Compiler design");
  
                      }
                      break;
  
                  case R.id.secondCheckBox:
                      if(mSecondCheckBox.isChecked()) {
  
                          String user_id = mAuth.getCurrentUser().getUid();
                          DatabaseReference current_user_db = mDatabase.child(user_id);
  
                          current_user_db.child("2").setValue("Operating Systems");
  
                      }
                      break;
  
                  case R.id.thirdCheckBox:
  
                      if(mThirdCheckBox.isChecked()) {
  
                          String user_id = mAuth.getCurrentUser().getUid();
                          DatabaseReference current_user_db = mDatabase.child(user_id);
  
                          current_user_db.child("3").setValue("Software Engineering");
  
                      }
                      break;
  
              }
              Intent interestIntent = new Intent(HomeActivity.this, InterestsActivity.class);
              interestIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
              startActivity(interestIntent);
  
          }
      });
  </code></pre>
  
  <p>This is what I want to achieve in Firebase database, but not getting. In between 'Users' and 'Values(1,2,3)' there must be user_Id. it is missing in the diagram
  because I have entered them in Firebase</p>
  
  <p><img src="https://i.stack.imgur.com/q91XP.png" alt="This is what I want to achieve in Firebase Database, but not getting. In between &#39;Users&#39; and &#39;Values(1,2,3)&#39; there must be user_Id. it is missing in the diagram"></p>
  
  <p>Please Guide me, where I am getting wrong. Tell me any other alternative to get this done, if I am completely wrong.</p>
  
  <p>Thanks in advance.</p>