Using the hardware "back" button on Android
This lesson will show you how to handle the user pressing the hardware "back" button on an Android device.
The backKey message
Android devices have a built in "back" button. LiveCode allows you to support the use of this button within your application by sending a backKey message to the current card.
If you do not pass or handle this message the engine will automatically quit.
Adding in support for the "back" button
In this stack we want the hardware "back" button to do the same as the "previous" button, unless we are on the first card, in that case we want the application to quit.
All we need to do is add a backKey message to our stack script that checks what card we are on and takes the appropriate action.
if the number of this card is 1 then
go to the previous card