title: how to check all the CheckBox are checked on button Click in android
body: <p>Below is the code where I am checking all the mandatory <code>CheckBox</code> is checked on NEXT button. There is totally 17 checkbox. But I am showing this in a Alert box so It is not taking this layout in View and taking the count of checked items in actual layout. Please help me to resolve this.   </p>
  
  <pre><code>public void showConfirmPopup()
  {
      final Dialog dialog = new Dialog(SubmitViewActivity.this);
      dialog.setContentView(R.layout.activity_uikyc);
      dialog.setCancelable(false);
      Button back=(Button)dialog.findViewById(R.id.btn_bck);
      Button next=(Button)dialog.findViewById(R.id.btn_next);
      final CheckBox[] checkboxes;
      checkboxes = new CheckBox[17];
  
      for(int i=0;i &lt; checkboxes.length; i++){
          checkboxes[i] = (CheckBox) findViewById(getIdName("check_" + (i+1)));
      }
  
      back.setOnClickListener(new OnClickListener() {
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          dialog.cancel();
      }
      });
  
      next.setOnClickListener(new OnClickListener() {
  
      @Override
      public void onClick(View view) {
          // TODO Auto-generated method stub
      //int lenCheck = checkboxes.length;
      int iCheck = 0;
      for(int i=0;i&lt;checkboxes.length;i++){
  
          if(checkboxes[i].isChecked()){
              iCheck++;
          }
  
      }
      Log.e(String.valueOf(iCheck), "count of checked option");
      if(iCheck != 17){
          Toast.makeText(SubmitViewActivity.this, "Confirm all Checkboxes are checked" , Toast.LENGTH_LONG).show();
          dialog.cancel();
      }else if(iCheck == 17){
      dialog.cancel();
      savedetails = new SaveDetails();
      savedetails.execute();
      }
      }
      });
  
      dialog.show();
  
  }
  </code></pre>