I have a pop up panel within the Activity so user can view additional information.
Which event must be monitored in order to prevent a Escape key press of ending the program?
Hello PassionDEV, I adapted the trap code as below, but the program is ending doesn't matter which option I pick on Msgbox2... Note that Activity.Finish is commented...
What am I doing wrong?
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Dim result As Int
result = Msgbox2("Deseja realmente sair?", "Confirme", "Sim", "", "Não", Null)
Log("Result = " & result)
If result = DialogResponse.Positive Then
' Activity.Finish
End If
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
'do what ever as return
closeconfirm
Return True
Else
Return False
End If
End Sub
Sub closeconfirm
Dim result As Int
result = Msgbox2("Deseja realmente sair?", "Confirme", "Sim", "", "Não", Null)
Select result
Case DialogResponse.POSITIVE
Activity.Finish
Case DialogResponse.CANCEL
closeconfirm
End Select
End Sub
not tested i have just write it in forum code editor
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
'do what ever as return
closeconfirm
Return True
Else
Return False
End If
End Sub
Sub closeconfirm
Dim result As Int
result = Msgbox2("Deseja realmente sair?", "Confirme", "Sim", "", "Não", Null)
Select result
Case DialogResponse.POSITIVE
Activity.Finish
Case DialogResponse.CANCEL
closeconfirm
End Select
End Sub
not tested i have just write it in forum code editor