问题描述
我是 android studio 的新手,能够在 Logcat 中接收以下数据,但现在需要能够在应用程序中查看该数据。
我如何才能更改此代码以执行此操作?
@Override
public void onCharacteristicChanged(BluetoothGatt gatt,BluetoothGattCharacteristic characteristic) {
super.onCharacteristicChanged(gatt,characteristic);
byte[] value = characteristic.getValue();
Log.i("BLE","receive value ----------------------------");
for (int i = 0; i < value.length; i++) {
Log.w("BLE","character_value = " + value[i]);
}
//processData(characteristic.getValue());
}
我知道要将数据发送到 android 上的 textView 我会使用这个:
((TextView)findViewById(R.id.data)).append(output);
但是 .append(output) 我不知道如何配置。
我可能会使用
StringBuilder output = new StringBuilder();
((TextView)findViewById(R.id.data)).append(output);
代替Log.i("BLE","receive value ----------------------------");
但是对于 Log.w("BLE","character_value = " + value[i]);我不确定,因为它是一个字符串和一个字节值。
如果有人能帮助我那就太好了!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)