private final BluetoothAdapter.LeScanCallback mScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
if (mScanLeDeviceList.contains(device)) return;
mScanLeDeviceList.add(device);
if (mOnLeScanListener != null) {
mOnLeScanListener.onLeScan(device, rssi, scanRecord);
}
broadcastUpdate(ACTION_BLUETOOTH_DEVICE, device);
}
};
当我扫描设备的时候,我设备发送广播非常快,差不多200ms一次,然后扫描停止的时候程序就崩溃了。
FATAL EXCEPTION: main
Process: com.application.android.box, PID: 10950
java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.contains(java.lang.Object)' on a null object reference
at com.application.android.box.blelib.BleService$2.onLeScan(BleService.java:464)
当我扫描设备的时候,我设备发送广播非常快,差不多200ms一次,然后扫描停止的时候程序就崩溃了。
FATAL EXCEPTION: main Process: com.application.android.box, PID: 10950 java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.contains(java.lang.Object)' on a null object reference at com.application.android.box.blelib.BleService$2.onLeScan(BleService.java:464)
这是错误消息!