I am bit stuck with an issue regarding raising events:
I have the following Java-code for raising the event:
The event raises just fine in B4J when I use the library directly in Main but if I make a B4J-Class where I call the library, the event will not fire in the Class and obviously the event will not fire in Main.
However, all method-calls (and properties) work just fine so I know that the target-module is correct.
This is the event and callback in Class-code:
and here is the event in Main:
Any ideas?
I have the following Java-code for raising the event:
B4X:
private void addVideoOutputEvents() {
player.getMp().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
@Override
public void timeChanged(MediaPlayer mediaplayer, long newTime){
if (ba.subExists(eventName + "_time")) {
ba.raiseEvent(B4JVlcj.this, eventName + "_time", new Object[] { newTime });
// Tests
// ba.raiseEventFromDifferentThread(B4JVlcj.this, null, 0, eventName + "_time", false, new Object[] {newTime});
// ba.raiseEvent2(B4JVlcj.this,false,eventName + "_time", false,new Object[] {newTime});
// ba.raiseEventFromUI(B4JVlcj.this, eventName + "_time", new Object[] { newTime });
}
}
});
}
The event raises just fine in B4J when I use the library directly in Main but if I make a B4J-Class where I call the library, the event will not fire in the Class and obviously the event will not fire in Main.
However, all method-calls (and properties) work just fine so I know that the target-module is correct.
This is the event and callback in Class-code:
B4X:
Private Sub vlc_Time (NewTime As Long)
'callbacks
Log(NewTime)
If SubExists(mModule, event & "_Time") Then
CallSub2(mModule, event & "_Time", NewTime)
End If
End Sub
and here is the event in Main:
B4X:
Sub vlc1_Time (NewTime As Long)
Log("Current time is " & NewTime)
End Sub
Any ideas?