Hi, I am using the DeviceList Activity in order to choose a device. But if I disable the BT, when viewing the DeviceList screen and choose one of the already rendered results, then in my onActivityResult() I get an NPE when trying to connect.
Specifically, in the BluetoothService.java, the ConnectThread's run method, the mmSocket.connect(); line gets a NPE, when executed. Since you already handle the IOException, would it be possible to add another NullPointerException catch block below?
public void run() {
// Always cancel discovery because it will slow down a connection
mAdapter.cancelDiscovery();
// Make a connection to the BluetoothSocket
try {
// This is a blocking call and will only return on a
// successful connection or an exception
mmSocket.connect();
} catch (IOException e) {
// Close the socket
try {
mmSocket.close();
} catch (IOException e2) { }
connectionFailed();
return;
}
// Reset the ConnectThread because we're done
synchronized (BluetoothService.this) {
mConnectThread = null;
}
// Start the connected thread
connected(mmSocket, mmDevice, mSocketType);
}
Hi, I am using the DeviceList Activity in order to choose a device. But if I disable the BT, when viewing the DeviceList screen and choose one of the already rendered results, then in my onActivityResult() I get an NPE when trying to connect.
Specifically, in the BluetoothService.java, the ConnectThread's run method, the
mmSocket.connect();
line gets a NPE, when executed. Since you already handle the IOException, would it be possible to add another NullPointerException catch block below?Thanks!