1

The following code shows the MAC address of each bluetooth found on the listview since I am passing ArrayList of type BluetoothDevice. I know I can get the name of each bluetooth device by using BlueToothDevice.EXTRA_NAME and then put all of them in an ArrayList of type String then pass this ArrayList to get what I want. However, I can't do that because ArrayList of type BluetoothDevice are those devices (with the MAC address) that I need to connect to when user clicks on it. This way I can connect to each of the bluetooth device but on the listview only the MAC address of each bluetooth device is shown. How can I make it to show the bluetooth's name instead of its MAC address and still able to connect. Thank You.

private ArrayList<BluetoothDevice> deviceList = new ArrayList<BluetoothDevice>();

ArrayAdapter adapter = new ArrayAdapter<BluetoothDevice>(this, android.R.layout.simple_list_item_1, deviceList);

btListView.setAdapter(adapter);
4

0 回答 0