Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a checkbox and onListItemClick in listview
    primarykey
    data
    text
    <p>What I am trying to accomplish is to have a checkbox in each row, having the ability to check the box separately (for batch deleting) and being able to select the entire row to view data associated with the list item.</p> <p>I have done a checkbox with a textview but that only lets be select the box and I cant click on the list item to view that items data. I also used <code>checkedTextView</code> but that checks the box where ever you click on the row calling the <code>onListItemClick</code> and thats not what I want either. Is there some what I can separate checking the box from clicking a listview item? </p> <p>Pretty much trying to do what the <code>gmail</code> app does when selecting messages to delete and view</p> <p>this is my row layout</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true"/&gt; &lt;TextView android:id="@+id/nameCheckTV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/checkBox1" android:layout_toRightOf="@+id/checkBox1" android:paddingTop="5dp" android:paddingLeft="15dp" android:text="Name" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>creating listview</p> <pre><code>@Override public void onActivityCreated(Bundle state){ super.onActivityCreated(state); lv = getListView(); lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); lv.setItemsCanFocus(false); setEmptyText("No Bowlers"); registerForContextMenu(getListView()); populateList(); } </code></pre> <p><strong>EDIT:</strong></p> <p>my populate method</p> <pre><code>public void populateList(){ String[] fields = new String[] {BowlersDB.NAME}; //mAdapter = new CheckAdapter(getActivity(),R.layout.check_listview,null,fields,new int[] {R.id.nameCheckTV}); mAdapter = new SimpleCursorAdapter(getActivity(),R.layout.check_listview,null,fields, new int[] {R.id.nameCheckTV}); setListAdapter(mAdapter); getLoaderManager().initLoader(0,null,this); } </code></pre>
    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.
    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