Android Question Problem with CallSub

F.Campanella

Member
Licensed User
Longtime User
Hi, I have this problem:

I have a lot of classes that have common methods. One common method is called "getDBPrefix"
I called this in a module that I call in a other module
At nested module i pass the istance of object and I call Callsub(object, "GetDBPrefix") but return the following error

What Am I wrong?

Error occurred on line: 194 (CLDB)
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:521)

Thanks for your help
 

F.Campanella

Member
Licensed User
Longtime User
no, not work. If I call same sub in the primary module does work, in the nested module don't work.
My class have several properties and I call CallSub when I not know the type of the object.

Example:
Class CLGestOrdClienti

Public Sub getDBPrefix As String
Return "cli"
End Sub

Primary module:

Dim a as string = CallSub(Cliente, "GetDBPrefix") //Work, but if I hover the mouse around the row return the error: "sub not found", but work correctly

in the same module call this:

Dim Cliente as CLCollection = DBUtil.LoadCollection(Cliente)

in the DBUtil module, at the sub LoadCollection I call this:

Dim DBPrefix as string = CallSub(pObject, "GetDBPrefix") // DON'T WORK, pObject is the istance of the object Cliente passed in the primary module (DBUtil.LoadCollection(Cliente))

Why? :-(

P.S. I am using the simulator, not the real device.
 
Upvote 0

Troberg

Well-Known Member
Licensed User
Longtime User
Have you tried renaming it to something completely different, such as RetrieveDBPrefix. I've had problems with using get* and Get*.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top