I am trying to create a library with events but i dont get to raise the event. I can not imagine what i am doing wrong.
The java code is the following one.
package anywheresoftware.b4a.sample;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Events;
@ShortName("FirstLib")
@Events(values={"OnMultiplyElapsed (result As Int)"})
public class FirstLib {
private String _eventName;
public void Initialize(String eventName) {
this._eventName = eventName;
}
/**
* Multiplies x 2
* @param x
* @return
*/
public int multiply(BA ba, int x) {
int result;
result = x * 2;
ba.raiseEvent(this, _eventName + "_OnMultiplyElapsed", new Object[]{result});
return x * 2;
}
}
And the b4Android code is the following one.
Sub Activity_Create(FirstTime As Boolean)
f.Initialize("FirstLibIMP")
Log(f.multiply (5))
End Sub
Sub FirstLibIMP_OnMultiplyElapsed (result As Int)
End Sub
The event is never launched !!!!!
The java code is the following one.
package anywheresoftware.b4a.sample;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Events;
@ShortName("FirstLib")
@Events(values={"OnMultiplyElapsed (result As Int)"})
public class FirstLib {
private String _eventName;
public void Initialize(String eventName) {
this._eventName = eventName;
}
/**
* Multiplies x 2
* @param x
* @return
*/
public int multiply(BA ba, int x) {
int result;
result = x * 2;
ba.raiseEvent(this, _eventName + "_OnMultiplyElapsed", new Object[]{result});
return x * 2;
}
}
And the b4Android code is the following one.
Sub Activity_Create(FirstTime As Boolean)
f.Initialize("FirstLibIMP")
Log(f.multiply (5))
End Sub
Sub FirstLibIMP_OnMultiplyElapsed (result As Int)
End Sub
The event is never launched !!!!!