android listview button control

Posted by Josemalive on Stack Overflow See other posts from Stack Overflow or by Josemalive
Published on 2010-03-12T15:09:56Z Indexed on 2010/03/12 16:27 UTC
Read the original article Hit count: 1373

Hi,

I have an android listview filled with items.

Every item has a button.

This is the template of the my listview.

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:paddingBottom="6dip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingLeft="5px"
        android:paddingTop="5px"
        android:paddingRight="5px"
        android:gravity="left">
        <TextView android:id="@+id/TextView_test1"
            android:layout_width="200dip"
            android:paddingLeft="0px"
            android:layout_height="wrap_content"/>
        <TextView android:id="@+id/TextView_test2"
            android:layout_width="250dip"
            android:paddingLeft="0px"
            android:layout_height="wrap_content" 
            android:layout_weight="1"/>
        <TextView android:id="@+id/TextView_test3"
            android:layout_width="400dip"
            android:paddingLeft="0px"
            android:layout_height="wrap_content"  
            android:layout_weight="1"/>
        <Button
        android:id="@+id/Button_buttontest"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/Button_buttontest"/>
</LinearLayout>

How could i handle the click of each button in the activity code? Each button has the same id "Button_buttontest"?

Thanks in advance. Best Regards. Jose

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk