Hi, Please see my original posting on StackOverflow here<http://stackoverflow.com/questions/12519856/android-custom-keyevent-not-passing-to-textview> - I couldn't get a response, and I think this problem is specific enough to ask here.
What I'm trying to do is capture all the likely keys from the keyboard, using int[] keycodes in the onKey(int kc, int[] keycodes) function of the example IME given in the SDK. I setProximityCorrectionEnabled(true) in my LatinKeyBoardView.java so that the keycodes[] array is properly initialised coming in to the onKey(...). I want to send these keys back to my application, which then uses another set of touch input to in fact determine which key was pressed. The way I do this is by using this <http://developer.android.com/reference/android/view/KeyEvent.html#KeyEvent(long, java.lang.String, int, int)>KeyEvent(...) constructor, as shown below. onKey(int primaryCode, int[] keyCodes) { ... String characterString = new String(); for (int c : keyCodes) { characterString += (char)c; } KeyEvent ke = new KeyEvent(SystemClock.uptimeMillis(), characterString, 0, KeyEvent.FLAG_SOFT_KEYBOARD); Log.e(TAG, "parceling: " + ke.getCharacters()); // Drop it into a parcel for experimenting. Parcel p = Parcel.obtain(); ke.writeToParcel(p, 0); // Construct KeyEvent from this parcel. KeyEvent kee = KeyEvent.CREATOR.createFromParcel(p); Log.e(TAG, "unparceled cstring: " + kee.getCharacters()); // Null ... } The last Log output is "unparceled cstring: null" I also get null from within my custom TextView onKey(...), although the KeyEvent that is passed in from the IME is properly constructed with event.getAction() == KeyEvent.ACTION_MULTIPLE, and event.getKeyCode() == KeyEvent.KEYCODE_UNKNOWN. It seems that KeyEvent.writeToParcel(...)/KeyEvent.CREATOR don't marshal/unmarshal the internal character array of the KeyEvent. Is this the expected behaviour? Or am I missing something. Thanks a lot, Matthew -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

