Open Activity Module and execute sub at widget click?

AFSSoftware

Member
Licensed User
Longtime User
Hi,
I have make a widget with an Service Module.
After click at Widget i want start my Main Module and execute an Sub.

How it works?
I try Application.Run:

Sub ImageView_wid_Click
Application.Run "Main.my_sub"
End Sub

But it reports:
Error parsing program.
Error description: Undeclared variable 'application' is used before it was assigned any value.
Occurred on line: 28
Application.Run "Main.my_sub"
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no such method / object named Application.
You can start an Activity by calling StartActivity(Main).

You can call a sub with CallSub. However you will only be able to call an activity sub after it is started. Usually you will want to set the value of a Process Global variable and then in Activity_Resume you should test the variable value and act accordingly.
 
Upvote 0
Top