Do not crash on null BT adapter, allows UI work on emulator.
This commit is contained in:
parent
57ecba16f3
commit
3ef942b5d3
|
@ -290,6 +290,11 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BluetoothAdapter adapter = bluetoothService.getAdapter();
|
BluetoothAdapter adapter = bluetoothService.getAdapter();
|
||||||
|
if (adapter == null) {
|
||||||
|
LOG.warn("No bluetooth available");
|
||||||
|
this.adapter = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!adapter.isEnabled()) {
|
if (!adapter.isEnabled()) {
|
||||||
LOG.warn("Bluetooth not enabled");
|
LOG.warn("Bluetooth not enabled");
|
||||||
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
|
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
|
||||||
|
|
Loading…
Reference in New Issue