相关疑难解决方法(0)

如何将蓝牙设备作为列表?

我试图获得我的粘合蓝牙设备,但我可以把它作为一个长字符串而不是列表.

这是我的代码:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
ArrayList<String> listview = 
new ArrayList<String>(Arrays.asList(pairedDevices.toString()));
setListAdapter(new ArrayAdapter<String>(this, R.layout.list, listview));
Run Code Online (Sandbox Code Playgroud)

我得到这样的东西:[00:23:7F:1c, f0:09:f1:b4:b0].一切都在一条线上.如何将其更改为列表而不是一行?

另外,我如何获得设备的友好名称而不是这些数字?

谢谢!!!

android listview bluetooth

24
推荐指数
3
解决办法
10万
查看次数

标签 统计

android ×1

bluetooth ×1

listview ×1