I have an activity which contains only a listview.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView android:id="@+id/list_data"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"/>
</LinearLayout>
Each row of this list is styled by this xml file. Each row has 2 textviews and a button.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:id="@+id/playPauseB"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Play" />
<TextView
android:id="@+id/rec_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="2dp"
android:gravity="center_vertical"
android:text="Example application"
android:textSize="20sp"
android:layout_toRightOf="@id/playPauseB" />
<TextView
android:id="@+id/rec_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rec_name"
android:text="Sample Data 2"
android:textSize="15sp" />
</RelativeLayout>
This listview has a cutom cursor adapter. My question is how to setup onClick listener for each button in a row. And how to access buttons of each row? My activity has a DBHelper object and customCursor object.My adapter contains a bindView and newView methods. Please comment if more details are needed.