Hi All
I have several handheld devices running Android 8.1 that have some extra rubber keys.
There is a home key, F1-F2 keys & a Menu key.
I don't think the Home key can be intercepted (if anyone knows otherwise I would love to be able to prevent its use) but the F1, F2 & Menu buttons do fire the KeyPress event.
They are KeyCodes 285, 132 & 54 respectively.
If I have an Activity_KeyPress sub then it fires but crashes on the Return statement, if I comment out my Activity_KeyPress then the app runs OK. Unfortunately I do want to handle the back key so I need Activity_KeyPress sub.
Below is a copy of the crash report (there is more if it would help):
Below is my Activity_KepPress code which I use in several apps without a problem, only when using these devices.
Thanks for any ideas...
I have several handheld devices running Android 8.1 that have some extra rubber keys.
There is a home key, F1-F2 keys & a Menu key.
I don't think the Home key can be intercepted (if anyone knows otherwise I would love to be able to prevent its use) but the F1, F2 & Menu buttons do fire the KeyPress event.
They are KeyCodes 285, 132 & 54 respectively.
If I have an Activity_KeyPress sub then it fires but crashes on the Return statement, if I comment out my Activity_KeyPress then the app runs OK. Unfortunately I do want to handle the back key so I need Activity_KeyPress sub.
Below is a copy of the crash report (there is more if it would help):
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x54 in tid 3111 (eryConfirmation), pid 3111 (eryConfirmation)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Remdun/RD52/RD52:8.1.0/O11019/1543226686:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 3111, tid: 3111, name: eryConfirmation >>> Company.DeliveryConfirmation <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x54
Cause: null pointer dereference
r0 00000054 r1 00000001 r2 0000000c r3 00000001
r4 c6bcc010 r5 00000000 r6 c6bcc024 r7 e7e4cf51
r8 00000000 r9 e50b393c sl 00000063 fp e50b38f0
ip e7f0ad80 sp ffb23938 lr e7e646d7 pc e6d26204 cpsr 200d0030
backtrace:
Below is my Activity_KepPress code which I use in several apps without a problem, only when using these devices.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
' handle the back key
If KeyCode = KeyCodes.KEYCODE_BACK Then
' get confirmation that the user wished to exit
Dim res As Int
Dim BD As BetterDialogs
res = BD.Msgbox("Please confirm","Are you sure you wish to exit the application.","Yes","","No",Null)
If res = -2 Then
' keep app open
Return True
Else
' close the app
Main.iResume = 1
Activity.Finish
End If
End If
Return False
End Sub
Thanks for any ideas...