Android Question Taking a MEMORY SNAPSHOT or maybe a CHECKPOINT ?

rfhall50

Member
Licensed User
Longtime User
While testing, I inadvertently hit the Android < key at the bottom. When I brought my screen back up, all test info that I had input was gone; program restarted from the beginning. Lesson learned, but also begs the questions:

  • Is there any "automated" way to periodically take a snapshot of memory ? This could then be used to reload memory and pick back up.
  • ANSWERED: Is there any way to programmatically control or intercept the Android <, O, (square box) controls?
Thanks.
Bob
 
Last edited:

rfhall50

Member
Licensed User
Longtime User
UPDATE: Handling an Android BACK key.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
    If KeyCode = KeyCodes.KEYCODE_BACK Then
    If Msgbox2("You have hit the BACK BUTTON."&Chr(10)&"If you answer YES, data entered will be LOST?"&Chr(10)&"Do you stil wish to EXIT ?","WARNING !!!"&"Hit CANCEL to continue scoring." ,"Yes", "Cancel", Null, Null) = DialogResponse.POSITIVE Then
        ' Return False
        ExitApplication 'App is exiting
        Else
        Return True
        End If
    End If
End Sub'
I found the above code in the forum. (Just have to know what to search for.)
Thank you to giannimaione for posting it. I did eliminate the "NO" response.
In my opinion,its either YES to exit, or CANCEL to continue in the app.
Here is his/her straight forward code snippet.
Bob
 
Upvote 0

rfhall50

Member
Licensed User
Longtime User
I found an answer to the BACK button question. Still wondering about the "Memory Snapshot" question.
Or maybe I should call it a "CHECKPOINT".
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
One piece of advise about the code posted above, the following line:
B4X:
ExitApplication
Better replace it with:
B4X:
Activity.Finish
The use of ExitApplication is not recommended, do a little research on the forum for more details.
 
Upvote 0
Top