title: Selecting All Items in a Listview on checkbox select
body: <p>I am using  simple listView with <em><code>simple_list_item_multiple_choice</code></em> 
  I have added a checkbox and on its checked event want all list items to get selected and on unchecked all items to get unselected.. 
  Here is the code..</p>
  
  <pre><code>CheckBox select_all = (CheckBox) dialog.findViewById(R.id.chk_all);
          arrayAdapter = new ArrayAdapter&lt;String&gt;
          (ctx,android.R.layout.simple_list_item_multiple_choice,readyToDownload );
          lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
          lv.setAdapter(arrayAdapter);
  
     select_all.setOnClickListener(new OnClickListener() {
      public void onClick(View v) {
              if(select_all.isChecked())
              {
                  // check all list items
              }
              if(!select_all.isChecked())
                  {
                      //  unselect all list items
                  }
  
              }
                  }); 
  </code></pre>