Android Question How to Pause/Stop/Interrupt Running Events using CallSubUtils

omo

Active Member
Licensed User
Longtime User
Assuming i have multiple events (let's say ten events) running at different assigned times as defined below under service_create/ service_resume of starter modules. Each of the ten events (Dataarrays1 -10) are working fine as scheduled one after the other. If all the events data array1,2....10 complete successfully before a user clicks on a button to open another activity/form(i.e cbt activity), everything seems fine. But if another activity is opened (..for example, a user clicks on a button to open another form) when the timed events have not finished execution up to the last event(dataarray10), the program crashes. If the execution has not finished up to the last dataarray 10, but a user wants to open another form(activity), how can i stop/cancel/pause the running events without crashing the program.

'These codes are defined under starter module
Sub Service_Create
cbt.proceed1 = False
csu.Initialize
Dim StringData1 As String
csu.CallSubDelayedPlus2("cbt", "DataArray1", 1000, StringData1)
End Sub

Sub service_resume
csu.Initialize
Dim StringData1, StringData2, StringData3,StringData4,StringData5,StringData6,StringData7,StringData8,StringData9,StringData10 As String
csu.CallSubDelayedPlus2("cbt", "DataArray1", 1000, StringData1)
csu.CallSubDelayedPlus2("cbt", "DataArray2", 15000, StringData2)
csu.CallSubDelayedPlus2("cbt", "DataArray3", 30000, StringData3)
csu.CallSubDelayedPlus2("cbt", "DataArray4", 45000, StringData4)
csu.CallSubDelayedPlus2("cbt", "DataArray5", 60000, StringData5)
csu.CallSubDelayedPlus2("cbt", "DataArray6", 75000, StringData6)
csu.CallSubDelayedPlus2("cbt", "DataArray7", 90000, StringData7)
csu.CallSubDelayedPlus2("cbt", "DataArray8", 105000, StringData8)
csu.CallSubDelayedPlus2("cbt", "DataArray9", 120000, StringData9)
csu.CallSubDelayedPlus2("cbt", "DataArray10",135000, StringData10)

End Sub

Sub Process_Globals
Public csu As CallSubUtils
Public proceed1 As Boolean
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub

Sub Service_Destroy
Log("Service_Destroy")
End Sub
 
Top