title: Multiple choice list with custom view?
body: <p>I've seen example <strong>com.example.android.apis.view.List11</strong> from ApiDemos. In that example, each row takes the view <strong>android.R.simple_list_item_multiple_choice</strong>. Each such view has a <code>TextView</code> and a <code>CheckBox</code>.</p>
  
  <p>Now I want each view to have 2 <code>TextView</code>s and 1 <code>CheckBox</code>, somewhat similar to the <strong>List3</strong> example. I tried creating a custom layout file row.xml like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
      &lt;CheckBox
          android:id="@+id/checkbox"
          android:layout_alignParentRight="true"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent" /&gt;
      &lt;TextView
          android:id="@+id/text_name"
          android:textSize="13px"
          android:textStyle="bold"
          android:layout_toLeftOf="@id/checkbox"
          android:layout_alignParentLeft="true"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" /&gt;
      &lt;TextView
          android:id="@+id/text_phone"
          android:textSize="9px"
          android:layout_toLeftOf="@id/checkbox"
          android:layout_below="@id/text_name"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" /&gt; 
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Then in <code>Activity</code>'s <code>onCreate()</code>, I do like this: </p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // Query the contacts
      mCursor = getContentResolver().query(Phones.CONTENT_URI, null, null, null, null);
      startManagingCursor(mCursor);
  
      ListAdapter adapter = new SimpleCursorAdapter(this,
              R.layout.row,
              mCursor, 
              new String[] { Phones.NAME, Phones.NUMBER}, 
              new int[] { R.id.text_name, R.id.text_phone });
      setListAdapter(adapter);
      getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  }
  </code></pre>
  
  <p>The result kind of looks like what I want, but it looks like the list doesn't know which item of it is selected. Also, I need to click exactly on the <code>CheckBox</code>. In the List11 example, I only need to click on the item row.</p>
  
  <p>So what do I need to do to make a multiple choice list with my custom view for each row? Many thanks.</p>