Android Question Parsing var name to call a routine

ocalle

Active Member
Licensed User
Hi, Is possible to pass the content of a Var as a call of a routine?
In other languages i see that %%VAR%% can acomplish that.

For example (not valid, for explain only)
B4X:
Sub Globals
Dim rutina As String : rutina="Mi rutina"
End Sub

Sub Activity_Create(FirstTime As Boolean)

Callsub2("",rutina,"")

end sub
if there is no solution I will not go against the tide

Thanks in advance
 

DonManfred

Expert
Licensed User
Yes. Call it after activity create has run.
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim methodname As String = "test"
End Sub
Sub test()
   Log("test called")
End Sub

Sub Activity_Resume
    CallSub(Me,methodname)
End Sub
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
test called
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
test called
Or use Callsubdelayed when calling from activity_create
 
Last edited:

ocalle

Active Member
Licensed User
WOW! THX!
 
Top