Hi,
I am using the following code when someone presses the back button on the device, and it displays the message box asking if I am sure if I want to close the app, but then disappears pretty straight away even without pressing the 'yes' button.
Is there a different way in doing this?
I am using the following code when someone presses the back button on the device, and it displays the message box asking if I am sure if I want to close the app, but then disappears pretty straight away even without pressing the 'yes' button.
Is there a different way in doing this?
B4X:
Sub appclose
Dim Answ AsInt
Dim Txt AsString
Txt = "Do you really want to close the app ?"
Answ=Msgbox2(Txt,"ATTENTION","Yes","","No",Null)
If Answ=DialogResponse.POSITIVE Then
Activity.finish
ExitApplication
Else
Return True
End If
End Sub
Sub Activity_Keypress (KeyCode As Int) As Boolean
If KeyCode=KeyCodes.KEYCODE_BACK Then
appclose
End If
End Sub