Android Question Calling another Actitvity within an Activity

Rainer@B4A

Member
Licensed User
Longtime User
My App starts with the Activity "Main".
In Activity_Create() I check the databases.
Sometimes the App needs some new databases in this case I jump into a Download Activity in which I guide the use to download the DBs.
My Problem is the resumable feature of calling the Download Activity with CallSubDelayed(), because the Main Activity still continues.

How can I let the Main-Activity wait until the Download Activity is finished ?
As a workaround I use a public Flag, but I think there must be a better way.

B4X:
Activity Main
Sub Activity_Create(FirstTime As Boolean)
    …
    WaitFlag = True
    CallSubDelayed(aDownload "CheckDatabases")
    Do While (WaitFlag): Sleep(0): Loop
    …
End Sub

Activity aDownload
....
Private Sub btnFinish_Click
    WaitFlag = False
    Activity.Finish
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…