Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IndexOutOfBoundsException: getChars (7 ... 0) has end before start

Tags:

android

My users are sending unhandled exceptions to me via http://code.google.com/p/android-remote-stacktrace/

I am getting the following but have no idea what it means.

java.lang.IndexOutOfBoundsException: getChars (7 ... 0) has end before start
   at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:935)
   at android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:847)
   at android.text.TextUtils.getChars(TextUtils.java:69)
   at android.text.SpannableStringBuilder.<init>(SpannableStringBuilder.java:59)
   at android.text.SpannableStringBuilder.subSequence(SpannableStringBuilder.java:839)
   at android.widget.TextView.extractTextInternal(TextView.java:4541)
   at android.widget.TextView.reportExtractedText(TextView.java:4580)
   at android.widget.TextView.finishBatchEdit(TextView.java:4723)
   at android.widget.TextView.endBatchEdit(TextView.java:4705)
   at com.android.internal.widget.EditableInputConnection.endBatchEdit(EditableInputConnection.java:54)
   at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:586)
   at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:174)
   at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:120)
   at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:231)
   at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:57)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4338)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
   at dalvik.system.NativeStart.main(Native Method)
like image 523
jax Avatar asked Feb 06 '10 19:02

jax


2 Answers

It's a known bug in the Android framework. Here's a link to the issue.

like image 150
Mark Byers Avatar answered Oct 11 '22 06:10

Mark Byers


if android couldnt set the selection you do that using cursor position... i resolved the issue by putting this exactly before the crashing line

editor.setSelection(editor.getText().length(), editor.getText().length());
like image 42
AMNNET.IR Avatar answered Oct 11 '22 05:10

AMNNET.IR