Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private final BroadcastReceiver devicesFoundReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (BluetoothDevice.ACTION_FOUND.equals(action)) {
- BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
- listAdapter.add(device.getName() + "\n" + device.getAddress());
- //mList.add(device.getName());
- for (int i = 0; i < listAdapter.getCount(); i++) {
- String str = listAdapter.getItem(i);
- mList.add(str);
- Log.d("Name", str);
- }
- listAdapter.notifyDataSetChanged();
- } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
- btnScan.setText("Scanning Bluetooth devices...");
- } else if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)) {
- btnScan.setText("Scanning in progress...");
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement