Before I added a button to the layout XML for my rows, the row ID was returned in the callback onListItemClick() upon a list item being clicked. Now that I added a button to the list row layout, this callback doesn't work anymore. I read that this is normal. I have been able to get the text and the new button to refer to new callbacks via the inclusion of this sort of thing in the layout XML file for my list row:
<Button
android:onClick="newCallBackFunctionName"/>
The problem is that I can't seem to find a way to retrieve the row id number corresponding to the list item in which the particular button that was pressed lies. In the case of onListItemClick() this was passed as part of the callback, but in the above case only the View object that is clicked is passed back to the callback newCallBackFunctionName. What can I do about this?
*Edit: My list is populated by a SimpleCursorAdaptor, in case that's important.
*Edit: My list and list row XML layouts are as follows:
List:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/basic_linear_layout_v1">
<TextView
android:id="@+id/category_selection_page_name"
style="@style/page_heading_v1"/>
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView
android:id="@id/android:empty"
style="@style/problem_text_v1"
android:text="@string/search_list_empty" />
<Button
android:id="@+id/select_category_button"
android:textSize="20sp"
android:layout_weight="10"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:onClick="reload"/>
Row:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/category_browse_name" style="@style/basic_list_item_v1"
android:layout_weight="1"
android:layout_gravity="left"
android:focusable="true"
android:clickable="true"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right">
<Button
android:text="..."
android:id="@+id/subcategories_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:focusable="true"
android:onClick="onSubcategoryButtonClick">
</Button>
</LinearLayout>