Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are handling second checkbox checking differently. May be the code should look like this? </p> <pre><code>if (checkBox2.isChecked()) { ... mapOverlays.add(custom2); } else { mapOverlays.remove(custom2); } </code></pre> <p><strong>Upd:</strong> if your code looks like in the current edit, then issue is the declaring <code>custom2</code> variable in the <code>if</code> block. You are deleting not added mapOverlay, but another one declared somewhere else.</p> <p>Just replace</p> <pre><code>if (checkBox2.isChecked()) { MapItemizedOverlay custom2 = ... </code></pre> <p>by </p> <pre><code>if (checkBox2.isChecked()) { custom2 = ... </code></pre> <p><strong>Upd2:</strong> there is yet another issue with your <code>onCheckedChanged()</code> method. First <code>if-else</code> runs not only on checkBox1 check/uncheck but also on checkBox2 check/uncheck. Same for the second <code>if-else</code>.</p> <p>Try to rewrite method:</p> <pre><code>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView.equals(checkBox1)) { // first if-else } else if (buttonView.equals(checkBox2)) { // second if-else } } </code></pre> <p>or even better:</p> <pre><code>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView.getId() == R.id.checkBox1) { if (isChecked) { ... mapOverlays.add(custom); } else { mapOverlays.remove(custom); } } else if (buttonView.getId() == R.id.checkBox2) { if (isChecked) { ... mapOverlays.add(custom2); } else { mapOverlays.remove(custom2); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload