Hello,
In a WatchUi.BehaviorDelegate class, in the onMenu() function, I'm trying to call a function from another class (the read() function from the Test class), but the application crashes.
Error code:
Error: Unexpected Type Error
Details: Failed invoking <symbol>
Stack:
- onMenu() at C:\Users\bapti\OneDrive\Bureau\ble\source\viewDelegate.mc:34 0x100000f1
- handleEvent() at 704b03c0.mb:1462 0x30002969
Encountered app crash.
Code :
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.BluetoothLowEnergy;
class viewDelegate extends WatchUi.BehaviorDelegate {
var test as Test?;
public function initialize() {
BehaviorDelegate.initialize();
test = _test; //new $.Test();
}
function onMenu() as Boolean {
test.read();
//WatchUi.pushView(new Rez.Menus.MainMenu(), new bleMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
}
import Toybox.Graphics;
import Toybox.WatchUi;
import Toybox.BluetoothLowEnergy;
import Toybox.Lang;
class Test {
function initialize() {
}
function read(){
}
}
Can you help me ?