title: How to pass a boolean value between activities with intents
body: <pre><code>public class StartActivity extends AppCompatActivity {
  
      private boolean addition=true;
      private boolean subtraction=false;
      private boolean multiplication=false;
      private boolean division=false;
  
      public static final String ADDITION = "";
      public static final String SUBTRACTION = "";
      public static final String MULTIPLICATION= "";
      public static final String DIVISION = "";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_start);
  
          final Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
          setSupportActionBar(myToolbar);
  
          CheckBox additionCheckBox = (CheckBox)findViewById(R.id.additionCheckBox);
          CheckBox multiplicationCheckBox = (CheckBox)findViewById(R.id.multiplicationCheckBox);
          CheckBox divisionCheckBox = (CheckBox)findViewById(R.id.divisionCheckBox);
          CheckBox subtractionCheckBox = (CheckBox)findViewById(R.id.subtractionCheckBox);
  
          Button playButton = (Button)findViewById(R.id.playButton);
  
          additionCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(buttonView.isChecked()){
                      addition = true;
                  }else{
                      addition = false;
                  }
              }
          });
  
          multiplicationCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(buttonView.isChecked()){
                     multiplication = true;
                  }else{
                      multiplication= false;
                  }
              }
          });
  
          subtractionCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(buttonView.isChecked()){
                      subtraction = true;
                  }else{
                      subtraction = false;
                  }
              }
          });
  
          divisionCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(buttonView.isChecked()){
                      division = true;
                  }else{
                      division = false;
                  }
              }
          });
  
          playButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if(!addition &amp;&amp; !subtraction &amp;&amp; !multiplication &amp;&amp; !division){
                      final Dialog dialog = new Dialog(StartActivity.this);
                      dialog.setContentView(R.layout.custom_dialog);
                      dialog.setTitle("My custom dialog");
  
                      //set the custom dialog components - text, image and button
                      TextView text = (TextView) dialog.findViewById(R.id.textView);
                      text.setText("Android custom dialog example!");
  
  
                      Button button = (Button) dialog.findViewById(R.id.button);
                      button.setOnClickListener(new View.OnClickListener() {
                          @Override
                          public void onClick(View view) {
                          dialog.dismiss();
                          }
                      });
  
                      dialog.show();
                  } else{
                      Intent i = new Intent(StartActivity.this, Main2Activity.class);
                      i.putExtra(ADDITION,addition);
                      i.putExtra(SUBTRACTION,subtraction);
                      i.putExtra(MULTIPLICATION,multiplication);
                      i.putExtra(DIVISION,division);
                      startActivity(i);
                  }
              }
          });
  }
  </code></pre>
  
  <p>This is the starting activity and I am trying to sent to the next activity the 4 boolean variables one for each basic math operation to see which one the user has checked. but they are always false in the next activity and i dont know why. here is the next activity:</p>
  
  <pre><code>public class Main2Activity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
  
          final Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
          setSupportActionBar(myToolbar);
  
          Intent i = getIntent();
          Bundle b = i.getExtras();
          boolean addition = b.getBoolean("ADDITION");
          boolean subtraction = Boolean.getBoolean("SUBTRACTION");
          boolean multiplication = b.getBoolean("MULTIPLICATION");
          boolean division = b.getBoolean("DIVISION");
  
          int operatorCounter =0;
  
          TextView additionTextView = (TextView) findViewById(R.id.additionTextView);
          TextView subtractionTextView = (TextView) findViewById(R.id.subtractionTextView);
          TextView multiplicationTextView = (TextView) findViewById(R.id.multiplicationTextView);
          TextView divisionTextView = (TextView) findViewById(R.id.divisionTextView);
  
          if (addition) {
              additionTextView.setText("addition:checked");
          }else{
              additionTextView.setText("addition:not checked");
          }
  
          if (subtraction) {
              subtractionTextView.setText("subtraction:checked");
          }else{
              subtractionTextView.setText("subtraction:not checked");
          }
  
          if (multiplication) {
              multiplicationTextView.setText("multiplication:checked");
          }else{
              multiplicationTextView.setText("multiplication:not checked");
          }
  
          if (division) {
             divisionTextView.setText("division:checked");
          }else{
            divisionTextView.setText("division:not checked");
          }   
      }
  }
  </code></pre>
  
  <p>I am setting the text in the textbox to see if the value is passed correctly but is always false. Sorry for bad code I'm quite new in android, actually is the forth mini project in android and its school homework.</p>