Ok so I've added the permission to the manifest file and paired my devices but I am getting a crash right here: Set pairedDevices = btAdapter.getBondedDevices();
I attempt to connect via a button click:
private OnClickListener myListener = new OnClickListener() {
public void onClick(View v) {
switch (v.getId()) {
case R.id.main_btnYes:
connectToNXT(); // connect to NXT
myIntent = new Intent(v.getContext(), SelectSession.class);
startActivityForResult(myIntent, 0);
break;
case R.id.main_btnNo:
myIntent = new Intent(v.getContext(), ExitScreen.class);
startActivityForResult(myIntent, 0);
break;
}
}
};
Here is the connectToNXT() method: The crash occurs here: Set bondedDevices = btAdapter.getBondedDevices(); private void connectToNXT() {
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
**Set<BluetoothDevice> bondedDevices = btAdapter.getBondedDevices();**
BluetoothDevice nxtDevice = null;
}
Anyone know why this would cause a crash?
Also, since I'm pretty new to android and bluetooth(2 days :D), could someone be kind enough to let me know of a good tutorial for android bluetooth?
Thanks,
Rich.