having to manage a collection of different objects, i'm trying to call the Initialize sub via CallSub
here is a minimal proof-of-concept (useless) code
This code throws the following exception
is Initialize forbidden to be called by CallSub?
here is a minimal proof-of-concept (useless) code
B4X:
Sub AppStart (Args() As String)
Dim o1 As Class1
Dim o2 As Class2
Dim a() As Object = Array As Object(o1, o2)
For Each o As Object In a
CallSub(o, "Initialize")
Next
End Sub
This code throws the following exception
Rich (BB code):
main._appstart (java line: 58)
java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:522)
at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:460)
at b4j.example.main._appstart(main.java:58)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.NullPointerException
at b4j.example.class1.callSub(class1.java:41)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:497)
... 9 more
is Initialize forbidden to be called by CallSub?