![]() |
KeyEvent dose not inherit from InputEvent - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +---- Forum: Android Development (https://forum.kodi.tv/forumdisplay.php?fid=184) +---- Thread: KeyEvent dose not inherit from InputEvent (/showthread.php?tid=291677) |
KeyEvent dose not inherit from InputEvent - jennifer_jiang - 2016-09-21 I have a problem about that KeyEvent inherits from CJNIBase in /xbmc/platform/android/jni/KeyEvent.h, but not InputEvent. While in /frameworks/base/core/java/android/view/KwyEvent.java, KeyEvent inherits from InputEvent?The injectInputEvent(InputEvent ev, int mod);I want to put the keyevent into the InputEvent,This dose't work.Please help me? RE: KeyEvent dose not inherit from InputEvent - Koying - 2016-09-21 And? Just make KeyEvent inherit from InputEvent if you require so... See for instance ByteBuffer which inherits from Buffer https://github.com/xbmc/xbmc/blob/master/xbmc/platform/android/jni/ByteBuffer.h#L27 Just be aware that C++/jni inheritance and java inheritance are 2 different things. Even if the C++/jni interface does not inherit from InputEvent, a KeyEvent jni object still inherits from InputEvent java-wise. RE: KeyEvent dose not inherit from InputEvent - jennifer_jiang - 2016-09-21 Thankyou for your reply. When I make KeyEvent inherit from InputEvent and run the kodi ,I got the fatal information: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 4587. I dont't know what cause the fatal. I want to know if I want to send keyevent to android, from jni to call inputManager.injectInputEvent ,the idea is right? or have other way to realize it in kodi ?Thankyou again for your reply. RE: KeyEvent dose not inherit from InputEvent - Koying - 2016-09-21 Show us some code, and please expose clearly what you are trying to achieve, i.e. what keypress are you trying to send from Kodi, to whom and why. RE: KeyEvent dose not inherit from InputEvent - jennifer_jiang - 2016-09-21 I want to call inputManager.injectInputEvent() to realize sending keyevent (as power like) to android. I add InputEvent.h and InputEvent.cpp.Then add some code in /xbmc/platform/android/jni/InputManager.h Code: static CJNIInputManager getInstance(); use the function CJNIKeyEvent ev = CJNIKeyEvent::obtain(....); CJNIInputManager::getInstance().injectInputEvent(ev, mode); Is it right? |