CallSub2 issue

jscoulter

Member
Licensed User
Longtime User
Hi All.

I just tried to call a sub in another unit using

CallSub2(Main,"MySub",oMapData)

however, it throws an error as below:

oSettings = CallSub2(Main,\
javac 1.6.0_21
src\com\blah\vss\blah.java:310: inconvertible types
found : java.lang.String
required: anywheresoftware.b4a.objects.collections.Map.MyMap
_osettings.setObject((anywheresoftware.b4a.objects.collections.Map.MyMap)(anywheresoftware.b4a.keywords.Common.CallSub2(processBA,(Object)(mostCurrent._main.getObject()),"GetSettingsFileData",(Object)(_osettings))));
^

I checked the documentation and there is nothing to say I "can't" do this, I am passing in an object of a type Map :)

Can someone confirm that this ISN'T possible, or is it a wee bug?

Jeremy
 

LittleEddie

Member
Licensed User
Longtime User
What do you mean by "another unit"?

the sub you are calling is in Activity "Main" is that in a service?

However the sub will only be called if the other module is not paused. In that case an empty string will be returned.
You can use IsPaused to test whether a module is paused.
This means that one activity cannot call a sub of a different activity. As the other activity will be paused for sure.
CallSub allows an activity to call a service sub or a service to call an activity sub.
Note that it is not possible to call subs of code modules.
 
Upvote 0

jscoulter

Member
Licensed User
Longtime User
Sorry....I am used to a different dev language that uses units.....yes the MAIN is the Activity and yes, I am calling this from a MODULE that is a service.

however, it doesnt matter if I use the Main Activity or the service module, I get an error. This error is returned by the compiler as it compiles the app.
I just noticed I didnt say that :)

Jeremy
 
Upvote 0
Top