Tryam Tryam - 2 months ago 7
Android Question

Choose first device from paired devices

How to choose first device in

pairedDevices
list without using
for
loop?

Do they number from 0 like in usual array or from 1?

Set<BluetoothDevice> pairedDevices = BA.getBondedDevices();

Answer

Set is an unordered Collection, the items cannot be accessed by an index.

The closest thing you can do is something like this:

BluetoothDevice firstDevice = pairedDevices.iterator().next();