I am developing an app containing a shopping cart and the items are stored in sqlite tables.
I have the following question:
What happens if the user is pressing the home button by chance? To my mind Android closes the app and thats it.
Creating a mess with an order not finished... etc.
In my windows applications I have a button like "Do you want to exit application (yes/no)?" making sure the user is taking this "exit" only.
How can I implement this in my android app resulting a proper end of my app?
Have a look at the Beginner's Guide chapter 18.6 Avoid closing an application.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the
event
Dim Answ As Int
If KeyCode = KeyCodes.KEYCODE_BACK Then
Answ = Msgbox2("Do you want to quit the program", _
"A T T E N T I O N", "Yes", "", "No", Null)
If Answ = DialogResponse.NEGATIVE Then
Return True
End If
End If
Return False
End Sub
What happens if the user is pressing the home button by chance? To my mind Android closes the app and thats it.
Creating a mess with an order not finished... etc.