I want to intercept a key. eg:volume_up
I use these code, it work. but if press home or back, the app will exit. it cant work.
B4X:
Sub Activity_keyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
ToastMessageShow("up",False)
Return True
End If
End Sub
Sub Activity_keyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
ToastMessageShow("up",False)
Return True
End If
End Sub
just add a test for KeyCodes.KEYCODE_VOLUME_DOWN.
this has nothing to do with back or home keys. what's the problem?
yes,i know it can work. but cant keep working when press a back key or home key. i need it work on background.when i browse web or do other thing, it still can work.