title: How to make uniquely acting buttons within each item of ListView?
body: <p>In my listview, I need each item to have a button icon that works distinctly according to the item that the button is selected in. The view displays values from ArrayLists (populated from SQLite Databases) that are different for each item. The button is essentially an edit option and is present for each item, <strong><em>so when the edit button is pressed, only the values from that item are retrieved.</em></strong></p>
  
  <p>Here's the XML for each item:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@id/list_item_header" &gt;
  
      &lt;TextView
          android:id="@+id/list_item_info"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_gravity="top"
          android:layout_marginLeft="40dp"
          android:gravity="right"
          android:textColor="#000000"
          android:textSize="20sp" /&gt;
  
      &lt;TextView
          android:id="@+id/list_item_values"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_toRightOf="@id/list_item_info"
          android:gravity="left"
          android:textColor="#000000"
          android:textSize="20sp" /&gt;
  
      &lt;TextView
          android:id="@+id/list_item_num"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:layout_gravity="right"
          android:layout_marginRight="20dp"
          android:textSize="40sp" /&gt;
  
      &lt;ImageButton
          android:id="@+id/button_edit"
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:layout_centerVertical="true"
          android:layout_marginRight="30dp"
          android:layout_toLeftOf="@+id/list_item_num"
          android:adjustViewBounds="true"
          android:contentDescription="@string/edit_button_description"
          android:scaleType="fitCenter"
          android:src="@drawable/editing_icon" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>_ - _ - _ - _ - _ - _ - _ - _ - _ - _ - _ - _ - _</p>
  
  <p>How do I implement a listener programmatically so that I can identify which item has been selected?</p>