Skip to content

KeyEvent.getCharacters() returns null instead of KEYCODE_UNKNOWN #142

@derenio

Description

@derenio

While testing the RST_editor example (https://github.com/kivy/kivy/tree/master/examples/RST_Editor) on HTC Desize Z I've tried to scroll loaded rst file with my trackpad and got this exception:

E/AndroidRuntime(25277): FATAL EXCEPTION: main
E/AndroidRuntime(25277): java.lang.NullPointerException
E/AndroidRuntime(25277):    at org.renpy.android.SDLSurfaceView.onKeyMultiple(SDLSurfaceView.java:1004)
E/AndroidRuntime(25277):    at org.renpy.android.SDLSurfaceView.onKeyPreIme(SDLSurfaceView.java:1047)
E/AndroidRuntime(25277):    at android.view.View.dispatchKeyEventPreIme(View.java:7179)
E/AndroidRuntime(25277):    at android.view.ViewGroup.dispatchKeyEventPreIme(ViewGroup.java:1338)
E/AndroidRuntime(25277):    at android.view.ViewGroup.dispatchKeyEventPreIme(ViewGroup.java:1338)
E/AndroidRuntime(25277):    at android.view.ViewGroup.dispatchKeyEventPreIme(ViewGroup.java:1338)
E/AndroidRuntime(25277):    at android.view.ViewRootImpl.deliverKeyEvent(ViewRootImpl.java:3608)
E/AndroidRuntime(25277):    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3163)
E/AndroidRuntime(25277):    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4294)
E/AndroidRuntime(25277):    at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2824)
E/AndroidRuntime(25277):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(25277):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(25277):    at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(25277):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(25277):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(25277):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(25277):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(25277):    at dalvik.system.NativeStart.main(Native Method)

the culprit line:
https://github.com/kivy/python-for-android/blob/master/src/src/org/renpy/android/SDLSurfaceView.java#L1004

The problem might be that according to http://developer.android.com/reference/android/view/KeyEvent.html#getCharacters() the trackpad's event is an ACTION_MULTIPLE and event.getCharacters() should return KEYCODE_UNKNOWN String, instead it returns null.
This might be an issue with the Android NDK itself, in that case someone more familiar with it could post this bug on a proper tracker.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions