Hi everyone
in activity, it's easy to call sub from in Line java to b4a, for example
but in b4aClass, I do not understand where the error comes from, here is my code
and this error :
These are other codes that I tried and unfortunately got the same error.
My main question is that, How call Sub From in Line java to B4a Class Module.
Thanks.
in activity, it's easy to call sub from in Line java to b4a, for example
call sub from java to b4a in activity:
Sub Activity_Create(FirstTime As Boolean)
Private jo As JavaObject
jo.InitializeContext
jo.RunMethod("startPreview1",Null)
End Sub
Private Sub send_qv(s As String)
Log(s)
End Sub
#if java
public void startPreview1() {
subQvEvent("send","Mohammad");
}
public void subQvEvent(String EventName,String values) {
processBA.raiseEventFromUI(this, EventName.toLowerCase(BA.cul) + "_qv", values);
}
#End If
but in b4aClass, I do not understand where the error comes from, here is my code
call sub from in Line java to b4a in b4aClass Module:
Public Sub Initialize
Private jo As JavaObject
jo.InitializeNewInstance(Application.PackageName&".check.thisQv", Array(Null))
jo.RunMethod("startPreview1",Null)
End Sub
Private Sub send_qv(s As String)
Log(s)
End Sub
#if java
public class thisQv{
import anywheresoftware.b4a.BA;
public BA processBA;
public BA ba;
public void startPreview1() {
subQvEvent("send","Mohammad");
}
public void subQvEvent(String EventName,String values) {
processBA.raiseEventFromUI(this, EventName.toLowerCase(BA.cul) + "_qv", values);
}
}
#End If
and this error :
error:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.BA.raiseEventFromUI(java.lang.Object, java.lang.String, java.lang.Object[])' on a null object reference
These are other codes that I tried and unfortunately got the same error.
call sub from java to b4a in b4aClass:
processBA.raiseEventFromUI(this, EventName.toLowerCase(BA.cul) + "_qv", values);
ba.raiseEvent(this,EventName.toLowerCase(BA.cul) + "_qv", values);
ba.raiseEvent(ba,EventName.toLowerCase(BA.cul) + "_qv", values);
ba.raiseEvent2(null, true, EventName.toLowerCase(BA.cul) + "_qv",false,values);
My main question is that, How call Sub From in Line java to B4a Class Module.
Thanks.
Last edited: