title: (Pre)select checkboxes in a ListActivity using 'simple_list_item_checked'
body: <p>I'm using the <strong>ListActivity</strong> class in conjunction with the <strong>simple_list_item_checked</strong>-layout which implements simple list items with <strong>checkboxes</strong>. Everything is working fine - clicking added items calls onListItemClick() and I can check/uncheck respective checkboxes of entries via the 'View v' parameter.</p>
  
  <p>However what I wasn't able to figure out yet is, how to (pre)select checkboxes without any userinteraction?</p>
  
  <p>Minimal so far working code snippet showing my intend:</p>
  
  <pre><code>package org.test;
  
  import android.app.ListActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.CheckedTextView;
  import android.widget.ListView;
  
  public class TestActivity extends ListActivity {
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          ArrayAdapter&lt;String&gt; list_elems = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_checked);
          list_elems.add("foobar");
          //TODO: check added entry labeled "foobar"
          setListAdapter(list_elems);
      }
  
      protected void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
             CheckedTextView check = (CheckedTextView)v;
          check.setChecked(!check.isChecked());
      }
  }
  </code></pre>
  
  <p>Thanks a lot in advance!</p>
  
  <p>daten</p>