Android Question Activity_Keypress in api 36 crashes

Scantech

Well-Known Member
Licensed User
Longtime User
I know it is a bit early for api 36, but i had to mention this problem.

SDK = 36 (android-36)
targetSdkVersion= 36

The following event is broken in API 36. It crashes when adding the event below and pressing back key. It does not report any errors at the log, just crashes. It is ok without the event, no crashes.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event

End Sub

I tested it with emulator (Android 16) and i do not have an actual device with Android 16 to test it. I hope its only in the emulator. Maybe someone can test it with a real device with Android 16.
 

Attachments

  • Keypress.zip
    10.2 KB · Views: 36
Last edited:

DonManfred

Expert
Licensed User
Longtime User
When it crashes thjen there MUST be an error in the LOG. Maybe in the unfiltered LOG.

Find it and post it.

PD: The recommended SDK is not 36
 
Last edited:
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
My old laptop can't keep up with polling and causing freeze issues. I crashed the app and exit the emulator. The log posted.
 

Attachments

  • log.txt
    320.3 KB · Views: 51
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
I tried and I get no crashes, using and Android 36 emulator.
The app never crashes but sometimes it's sent to background, probably because the KeyBack is catched by the OS as it is not consumed by the app.
Anyway I would not spent too much time with something that maybe request a B4A update for some changes in Android 36 and that now it's not requested.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I tested it in emulator, no crash. even if there is no return value in sub keypress.
Try reinstalling the emulator.

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
    Dim ph As Phone
    Log(ph.SdkVersion)
    Log("key="&KeyCode)
    Return False
End Sub
1.png
2.png


3.png
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
@teddybear
I wonder why you get a keycode=67 when the KeyBack should be 4, if I am correct.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I pressed the key backspace on keyborad.
Keycode 4 is ESC on my pc, there is also no crash

3.png
 
Last edited:
Upvote 0
Top