I found a great simple example (provided by Erel) of using two Activities here:
https://www.b4x.com/android/forum/threads/two-activities-example.6611/
In order to prove what I am trying to prove, I have modified Erel's
Button1_Click code slightly to add a few
Log messages and a delay loop immediately after the
StartActivity instruction (please see the attached project: TwoActivities2.zip)
Sub Button1_Click
StartActivity(Activity2)
Log("This statement occurs right after Activity2 Started")
For k=0 To 100000
If (k Mod 10000) = 0 Then
Log("k = " & k)
End If
Next
Log("This statement occurs after the Main Activity delay loop")
End Sub
This is the result that occurs in the Log window of my example when the program is run and Button1 is clicked (and includes a subsequent Click in Activity2):
===================================
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
This statement occurs right after Activity2 Started
k = 0
k = 10000
k = 20000
k = 30000
k = 40000
k = 50000
k = 60000
k = 70000
k = 80000
k = 90000
k = 100000
This statement occurs after the Main Activity delay loop
** Activity (main) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = true **
** Activity (activity2) Resume **
** Activity (activity2) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
===================================
So, as you can see,
Activity_Pause in the Main Activity does not occur until the
END of the SUB in which
StartActivity is used (which, in my example, occurs several seconds later).
AND, I have also verified my "
Clarification 1", which is seen at the end of the
Log window, where only
Activity_Resume is executed in Main, while
Activity_Create in Main is NOT executed.
I also learned that, to exit the second Activity to return to the Main Activity, you issue a
StartActivity(Main) instruction in the second Activity (as opposed to using an
Activity.Finish instruction).
I'm glad I was able to clarify this, with thanks to Erel and RandomCoder, and I hope it helps others that want to use other Activities in their Apps.