btArrayAdapter
现在包含所有配对的蓝牙设备。稍后我想检查这些设备是否还活着。如果没有,它应该向我显示该设备名称。
ArrayAdapter<String> btArrayAdapter = new ArrayAdapter<String>(
this, android.R.layout.simple_list_item_1);
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
if (pairedDevices.size() > 0) {
for (BluetoothDevice device : pairedDevices) {
String deviceBTName = device.getName();
String deviceBTMajorClass = device.getAddress();
btArrayAdapter.add(deviceBTName + "\n" + deviceBTMajorClass);
}
}
setListAdapter(btArrayAdapter);
如何检查它?谢谢