B4J Question Really weird thing with CallSub... (strings don't work?)

MegatenFreak

Active Member
Licensed User
Hi. In my code, I wanna pass the name of a function to another module so it can run it when it wants (as a callback), since I can't pass the function itself as a parameter. But it doesn't work. the totally weird thing is that if I put in the function name directly, it works, but not when it's in a variable:

B4X:
'This works perfectly:
CallSub(Me, "Picked")

'But this doesn't:
Dim name as String = "Picked"
CallSub(Me, name)

I don't understand what the difference is. And anyway, how am I supposed to tell my app to run that function?
 
Top