我一直在尝试使用 TI Sensor Tag 在我的 Android 应用程序中引入通知。我查阅了用户指南并找到了以下代码。任何人都可以帮助我如何摆脱错误并为我的android应用程序上弹出的通知引入正确的代码。
package ti.android.ble.sensortag;
public void onCharacteristicChanged(BluetoothGattCharecteristic c) {
Integer encodedInteger = c.getIntValue(FORMAT_UNIT8, 0);
SimplKeysStatus newValue = SimpleKeysStatus.values()[encodedInteger %4];
model.setSimpleKeysStatus(newValue);
}
public enum SimpleKeysStatus {
// Warning: The order in which these are defined matters.
OFF_OFF, OFF_ON, ON_OFF, ON_ON;
}
错误如下:
此行有多个标记
- Syntax error on token(s), misplaced construct(s)
- Syntax error, insert "enum Identifier" to complete EnumHeader
- Syntax error on token "void", @ expected
- Syntax error on token "{", ; expected after this token
- Syntax error on token(s), misplaced construct(s)