Android Question Calling a code module sub like CallSub

qsrtech

Active Member
Licensed User
Longtime User
I'm trying to take advantage of the Rapid Debugger in my project. Due to it's size and complexity I need to move a lot of core elements to a library (as was suggested to do), unfortunately it's becoming a daunting task since I can't seem to use CallSub in a code module (to call subs within a code module). I use Http service extensively, unfortunately without being able to pass the code module to the http service to call back, it's proving to be impossible to build my "core" library. Any suggestions how to move forward?
 

qsrtech

Active Member
Licensed User
Longtime User
I can sort of call the subs directly if I could get the httpservice to callback to a code module.
 
Upvote 0

qsrtech

Active Member
Licensed User
Longtime User
I think I've got mostly everything working in my "core" library now. Created a new version of httputils to call back a fixed sub in my core code module. Then from there I case through and call other subs within the code module to handle the "results".
 
Upvote 0

qsrtech

Active Member
Licensed User
Longtime User
Very close to being able to use the rapid debugger with my project. Ran into a little snag. I have this list object (aka collection) declared in my core code module

Public colButtons As List:colButtons.Initialize

in a routine I have this line which the compiler throws an error about an activity and declaring in "Globals" vs Process_Globals. AButton is a class with various views in it. The weird thing is that the list object was declared in code module already before, albeit the adding to the list was always done in an activity object.
colButtons.Add(AButton)

My workaround to make it complie is this line, unfortunately it forces interaction with the main activity which slows everything down again.
CallSub2(CallBackMod,"AddAButton",AButton)

all the "AddAButton" sub does is:
base.colButtons.Add(AButton)

any suggestion for a work around to not have to call back to the main activity to add this "Button" class to my list object?

EDIT: After further testing in "rapid" mode, it appears my library hangs when it "callsub" back to my main activity.

I've managed to trick the compiler to add my "AButton" to my list object by assigning the "AButton" object to a local "object" variable then adding the local "object" variable
B4X:
    Dim AObject As Object
            AObject=AButton
            colButtons.Add(AObject)
 
Last edited:
Upvote 0

qsrtech

Active Member
Licensed User
Longtime User
Finally getting "rapid" debugger to work with my project(s). Running into a little problem with one important thing though. I have this pretty simple object/class "TMaco". When running "rapid" it crashes at this line:
If AMacro.IsInitialized=False Then
with this error message:
java.lang.RuntimeException: Method: IsInitialized not found in: java.lang.Object

FYI a few lines above the "test" is:
If AButton.DataPtr Is TMacro Then
AMacro=AButton.DataPtr

And AMacro is defined as:
Dim AMacro As TMacro

I have other similar objects and test "IsInitialized" on them without any problem.

Again, everything seems to work fine in "legacy"
 
Upvote 0
Top