Xau*_*hal 2 android bluetooth-lowenergy android-bluetooth gatt
我正在尝试使用以下代码读取特征并获取其值
private byte[] val;
mBluetoothLeService.readCharacteristic(characteristic);// reads it
val=characteristic.getValue();
String s=new String(val);
Run Code Online (Sandbox Code Playgroud)
我的应用程序崩溃给出错误"应用程序可能在其主线程上做了太多工作."
我也试过了
private String s;
mBluetoothLeService.readCharacteristic(characteristic);// reads it
s=characteristic.getStringValue(0);
Run Code Online (Sandbox Code Playgroud)
但错误是一样的
我调试了我的代码以检查它是否获得了值
private String s;
mBluetoothLeService.readCharacteristic(characteristic);// reads it
s=characteristic.getStringValue(0);
system.out.println(s);
Run Code Online (Sandbox Code Playgroud)
它显示正确的值,但在运行代码为Android App时.我犯了同样的错误.
| 归档时间: |
|
| 查看次数: |
4212 次 |
| 最近记录: |