The question is based on the following:
Main Activity:
Dim varClass as MyClass
varClass.Initialize("This is a name", "String", 1)
MyModule
Public Sub CompareParam2vsParam3(objDataType As Object) As String
Dim strObjName As String
strObjName = GetType(objDataType)
strObjName = strObjName.Replace("java.lang.", "")
Return strObjName
End Sub
MyClass
Public Sub Initialize(Name As String, DataType As String, DefaultValue As Object)
Dim strDataTypeDefaultValue As String
strDataTypeDefaultValue = MyModule.CompareParam2vsParam3(ObjDataType)
If DefaultValue = Null OR DataType <> strDataTypeDefaultValue Then
'ERROR TypeMismatch
' The data type and default value does not match.
Else
strDataType = DataType
End If
End Sub
At line MyModule.CompareParam2vsParam3(ObjDataType) in MyClass, stops and log is:
Error occurred on line: 90 (MyClass)
java.lang.NullPointerException
at anywheresoftware.b4a.B4AClass$ImplB4AClass.getActivityBA(B4AClass.java:20)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:633)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:298)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:237)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:116)
at ar.com.sysprofile.rtrating.main.afterFirstLayout(main.java:98)
at ar.com.sysprofile.rtrating.main.access$100(main.java:16)
at ar.com.sysprofile.rtrating.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)
For this reason I tried with other functions, like CallSubDelayed2. But now I know, does not return data CallSubDelay2 by design