I have a custom ListView. This ListView contains Bluetooth Devices found during a Scan. I want to have the possibility to click on one single item (i.e. Bluetooth Device) of the list and at the end of the list I want a Button, that allows me to connect to the selected Device. The problem is that I can't get a single button at the end of the list, but I have a button for each item of the list.
This is my XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".DeviceScanActivity"
tools:ignore="ExtraText">
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
</ListView>
<TextView
android:id="@+id/device_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20sp" >
</TextView>
<TextView
android:id="@+id/device_address"
android:textSize="12sp"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/connectButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Connect"
android:onClick="ConnectButton"
android:layout_gravity="center">
</Button>
</LinearLayout>
</RelativeLayout>