code: public boolean isChecked() {
  
          boolean checked = false;
  
          if (view instanceof CompoundButton) {
              CompoundButton cb = (CompoundButton) view;
              checked = cb.isChecked();
          }
  
          return checked;
      }
docs: Get checked state of a compound button.
  
  @return checked