public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (DEBUG) Log.d(LOG_TAG, "onActivityResult " + resultCode);
    switch (requestCode) {
      case REQUEST_CONNECT_DEVICE:
        forceUpdateCamera = true;
        // When DeviceListActivity returns with a device to connect
        if (resultCode == Activity.RESULT_OK) {
          // Get the device MAC address
          String address = data.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
          // Get the BLuetoothDevice object
          BluetoothDevice device =
              mBluetoothAdapter.getRemoteDevice(
                  address); // I deleted "m." before the method getRemoteDevice()
          // Attempt to connect to the device
          mSerialService.connect(device);
        }
        break;

      case REQUEST_ENABLE_BT:
        // When the request to enable Bluetooth returns
        if (resultCode != Activity.RESULT_OK) {
          Log.d(LOG_TAG, "BT not enabled");
          forceUpdateCamera = true;
          mEnablingBT = false;
          // finishDialogNoBluetooth();
        } else {
          Intent serverIntent = new Intent(this, DeviceListActivity.class);
          startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
        }
    }
  }