Is it possible to use ba.raiseEvent to call a callback sub in the enclosing Activity,class,service or code module? It doesn't give an error, just no result either.
In a class, I've tried:
The sub is found, but not called. result is an int and the target sub has one parameter which is an Int.
I can get the result I want by using conditional compilation and two subs that call the target sub directly with different signatures for Debug and Release modes. But I am hoping for a simple alternative.
Thanks
In a class, I've tried:
B4X:
Sub DoMultiply
nativeMe.RunMethod("Multiply", Array ("logresult",10))
End Sub
Sub LogResult(Result As Int)
Log(Result)
End Sub
#If JAVA
private int mm = 100;
public void Multiply(String EventName,int i) {
int result = i * 2 + mm;
if(ba.subExists(EventName)){
BA.Log("Found");
ba.raiseEvent(this,EventName.toLowerCase(),result);
} else {
BA.Log("Not Found");
}
}
#End If
The sub is found, but not called. result is an int and the target sub has one parameter which is an Int.
I can get the result I want by using conditional compilation and two subs that call the target sub directly with different signatures for Debug and Release modes. But I am hoping for a simple alternative.
Thanks