if I use CallSubDelayed to call an Activity routine from a service, you can see that when you close the Activity it will be restarted,
This is due to the fast execution of the two CallSubDelayed; the first one starts the Activity, but the second one does not find the Activity already open, then it starts the Activity again.
I have to use:
If IsPaused(actTwo) Then
StartActivity(actTwo)
End If
Unfortunately, in the project attached that code is enough, in my app not
In fact it should not be sufficient because starting the Activity does not means wait that it has been completely started (resumed).
Any suggestion? (I tried to use a process globals boolean variable ActivityIsStarted, set it to True in Activity_Resume and add this code after StartActivity (in my app):
If IsPaused(MyAct) Then
StartActivity(MyAct)
Do While Not(MyAct.ActivityIsStarted)
DoEvents
Loop
End If
(code "hated" by Erel
), but, although the Activity is called from a service, it seems that Activity_Resume (nor Activity_Create) is executed.
I could call a service's routine from Activity_Resume but it would be a mess.
Another day and I'm ready... for a psychiatrist!