Hi guys,
I have 3 activities, Main Activity, and 2 child activity.
Here are the codes snippet in Main Activity
When Child2 Activity is active and user pressed back key, I want to quit from app, not return to Main Activity.
I tried these codes on Child2 Activity, but no avail
If I changed codes for Button2_click on Main Activity to these one
It works as intended, but is this the correct procedure?
Thanks in advance.
I have 3 activities, Main Activity, and 2 child activity.
Here are the codes snippet in Main Activity
B4X:
Sub Process_Globals
Dim SqlLt As SQL
End Sub
Sub Button1_Click
StartActivity(Child1)
End Sub
Sub Button2_Click
StartActivity(Child2)
End Sub
When Child2 Activity is active and user pressed back key, I want to quit from app, not return to Main Activity.
I tried these codes on Child2 Activity, but no avail
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
ExitApplication
End If
End Sub
If I changed codes for Button2_click on Main Activity to these one
B4X:
Sub Button2_Click
Activity.Finish
StartActivity(Child2)
End Sub
It works as intended, but is this the correct procedure?
Thanks in advance.
Last edited: