Android Studio Checkbox Ergebnis

static int m=0;
dualDisplay.setOnClickListener(new OnCli....{
     onClick()
     {
          if(dualcamera1.isChecked())
              m++; // you can save this as checked somewhere
          if(dualcamera2.isChecked())
              m++; // you can save this as checked somewhere
          if(dualcamera3.isChecked())
              m++; // you can save this as checked somewhere
          if(dualcamera4.isChecked())
              m++; // you can save this as checked somewhere
     }
});
if(m>2 || m<2)
      // show error message
else
      // code here
Smoggy Seal