0

I used the following code to get a list of all the paired devices in the mobile phone:

  BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
  Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();

  List<String> s = new ArrayList<String>();
  for (BluetoothDevice bt : pairedDevices) {
      s.add(bt.getName());
  }

  for (int index = 0; index < s.size(); index++) {
      Toast.makeText(this, "Device Name: " + s.get(index), Toast.LENGTH_SHORT).show();
  }

I have Bluetooth headsets that are already paired and I want my application to connect to those headphones in this way:

In this way

Zoe
  • 27,060
  • 21
  • 118
  • 148
Diego
  • 167
  • 7
  • What is your question? Is it not working? what exact error are you running into? – Zakir May 21 '18 at 23:55
  • Possible duplicate of [Programmatically connect to paired Bluetooth device](https://stackoverflow.com/questions/5171248/programmatically-connect-to-paired-bluetooth-device) – SoroushA May 22 '18 at 00:24

0 Answers0