title: Android custom ListView with TableRow within. setOnclickListener?
body: <p>I'd like an insight for this problem please.
  I'm new to this ListView. I have managed to put in data from database, and set the id of list item to id of a DB record. </p>
  
  <p>Everything OK when using android.R.layout.simple_list_item_1 for the layout and android.R.id.text1 for the TextView where my Text would be. 
  I even set the setOnItemClickListener and got a Toast whit correct data (item position and the _id i have set). </p>
  
  <p>Than I wanted to use a TableRow or TableLayout as a custom layout for list items. 
  That works, but I don't know how to get reference to the Views in the TableRow (ie. TableRow itself)? </p>
  
  <p>setOnItemClickListener stops working and I cannot use setOnclickListener on the row. </p>
  
  <p>Is it possible to somehow use that kind of technique if I wanted to get POSITION and ID of a ListView item or should I use something smarter?</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class ListView1 extends ListActivity {
      private DBAdapter db;
      private Cursor getMatchigItems;
      private OnItemClickListener listener;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
  
                  db = new DBAdapter(this);
                  db.open();
                  getMatchigItems = db.getMatchingItems(4, 1);
                  startManagingCursor(getMatchigItems);
  
  //              SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
  //                      android.R.layout.simple_list_item_1,
  //                      getMatchigItems,
  //                      new String[]{db.KEYITEMS_TXTITEMNAME, db.KEYITEMS_ROWID},
  //                      new int[]{android.R.id.text1});             
  //              setListAdapter(adapter);
  
                  SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
                          R.layout.table_row,
                          getMatchigItems,
                          new String[]{db.KEYITEMS_TXTITEMNAME, db.KEYITEMS_ROWID},
                          new int[]{R.id.textViewItems1});                
                  setListAdapter(adapter);
  
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);
          lv.setOnItemClickListener(listener);
  
          lv.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
  
                  Toast.makeText(getApplicationContext(), "id: " + String.valueOf(id) + "\npos: " + String.valueOf(position), Toast.LENGTH_SHORT).show();
  
              };
          });         
      }
  }
  </code></pre>
  
  <p>And this is the TableRow layout I wanted to use:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/tableRowLayout"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
  
  &lt;TableRow
      android:id="@+id/tableRowLayoutRow1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/rowcat"
      android:layout_marginTop="2dp"
      android:minHeight="40dp" android:gravity="center_vertical"&gt;
  
      &lt;View android:id="@+id/imagePlaceholderBlank1Items"
              android:layout_width="40dp"
              android:minHeight="40dp" android:layout_height="fill_parent" android:background="@drawable/editicon"/&gt;
       &lt;TextView android:id="@+id/textViewItems1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Tule bo ime artikla" style="@style/whiteText" android:layout_marginLeft="10dp" android:ellipsize="marquee" android:lines="1" android:focusable="true" android:width="220dp" android:scrollHorizontally="true" android:marqueeRepeatLimit="marquee_forever" android:focusableInTouchMode="true"/&gt;
          &lt;TextView android:id="@+id/imagePlaceholderButton1Items"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:minHeight="40dp"
              android:gravity="center" android:textColor="#FFF" android:background="@drawable/buttonoff" android:tag="off"/&gt;
  &lt;/TableRow&gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>Thanks in advance for any advice!</p>