Main module:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If Msgbox2("Do you want to close?", "", "Yes", "", "No", Null) = DialogResponse.POSITIVE Then
another activity.finished=True
and another activity.finished=True
............................
last activity.finished=True
Activity.Finish()
Return True
.................................
In each Activity module:
Sub Activity_Resume
If finished Then
finished=False
Activity.Finish()
End If
End Sub