Wednesday, May 30, 2012

[android-developers] Re: keys not being issued on android 4.0

Hi,

Got it working with this (lines marked with * was crucial):

public InputConnection onCreateInputConnection(EditorInfo outAttrs)
{
outAttrs.inputType =
android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; // *
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; // *

return new BaseInputConnection(this, false)
{
public boolean deleteSurroundingText(int leftLength, int
rightLength)
{
if (rightLength > 0 && leftLength == 0) // do not handle
right deletions
return true;
while (leftLength-- >= 0)
{
if (!sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_DEL)))
return false;
if (!sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
KeyEvent.KEYCODE_DEL)))
return false;
}

return true;
}
};
}

guich
www.superwaba.com.br

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment