Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: ListView with multiple choice and subitems enabled
    primarykey
    data
    text
    <p>I'm trying to get my contacts on a list view. Now I know that using <code>simple_list_item_multiple_choice</code> enables me to select multiple contacts, but it views names only without numbers.</p> <p>On the other side, <code>simple_list_item_2</code> can be used to show both name and number, but supports selection of only one contact.</p> <p>Is there any template that combine them both? If not, how could I build my customized list with both features?</p> <p>EDIT: This is the code I'm using</p> <pre><code>CursorLoader cl = new CursorLoader(this,ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+" ASC"); Cursor c = cl.loadInBackground(); SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_multiple_choice, // Use a template // that displays a // text view c, // Give the cursor to the list adapter new String[] { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME}, new int[] { android.R.id.text1},0); setListAdapter(adapter); </code></pre> <p>Here, the second parameter of SimpleCursorAdapter is <code>simple_list_item_multiple_choice</code> but it supports only dealing with <code>android.R.id.text1</code>. So I can use items only, not subitems.</p> <p>But in the following code</p> <pre><code>SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_expandable_list_item_2, // Use a template // that displays a // text view c, // Give the cursor to the list adapter new String[] { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ,ContactsContract.CommonDataKinds.Phone.NUMBER}, new int[] { android.R.id.text1,android.R.id.text2},0); </code></pre> <p>I can give it both <code>ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME</code> and <code>NUMBER</code> to be written in <code>android.R.id.text1</code> and <code>android.R.id.text2</code>, but can't use multiple choice feature.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload