title: Android CheckBox Select all
body: <p>I am stuck in a scenario. I have a list view with multiple items and a checkbox in all, Now I have implemented a feature when someone presses the select all button, all the list view items checkboxes should be selected and vice versa.</p>
  
  <p>Now I have to implement, after pressing select all, if the user unchecks some of the items from the list items - then THE SELECT ALL BUTTON SHOULD BE AUTOMATICALLY UNCHECKED.</p>
  
  <pre><code> /** Select All checkbox functionality here.. */
          mcbSelectAllContact
          .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView,
                      boolean isChecked) {
                  groupListAdapter = new GroupMemberListAdapter(
                          buttonView.getContext(), isChecked);
                  mlvGroupContactList.setAdapter(groupListAdapter);
                  if (mcbSelectAllContact.isChecked()) {
                      for (int i = 0; i &lt; mBooleanArray.length; i++) {
                          mBooleanArray[i] = true;
                      }
                  } else {
                      for (int i = 0; i &lt; mBooleanArray.length; i++) {
                          mBooleanArray[i] = false;
                      }
                  }
              }
          });
  </code></pre>