Hi all,

I'm developing an InputMethod and therefore relying on InputMethodService 
and it's getCurrentInputConnection to retrieve an InputConnection. I'm 
trying to extract the current text from the input connection, via the 
getExtractedText method and it works *most* of the time. However, most is 
not enough and for instance when calling it on a textfield in a webview it 
returns null without any valid reason or any errors thrown in the log.

I also tried the three other functions of the InputConnection class: 
getTextBefore/AfterCursor and getSelection and my input method manages to 
crash certain system apps (Browser or Search for instance) with the 
following type of error.

E/AndroidRuntime( 7032): FATAL EXCEPTION: main
E/AndroidRuntime( 7032): java.lang.IndexOutOfBoundsException: getChars (70 
... -2147483579) has end before start
E/AndroidRuntime( 7032): at 
android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1009)
E/AndroidRuntime( 7032): at 
android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:913)
E/AndroidRuntime( 7032): at 
android.text.TextUtils.getChars(TextUtils.java:74)
E/AndroidRuntime( 7032): at 
android.text.TextUtils.substring(TextUtils.java:260)
E/AndroidRuntime( 7032): at 
android.view.inputmethod.BaseInputConnection.getTextAfterCursor(BaseInputConnection.java:393)
E/AndroidRuntime( 7032): at 
com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:202)
E/AndroidRuntime( 7032): at 
com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
E/AndroidRuntime( 7032): at 
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7032): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 7032): at 
android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 7032): at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 7032): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 7032): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 7032): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 7032): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 2733):   Force finishing activity 
com.android.browser/.BrowserActivity

Thanks for any help from fellow input methods developers!

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to