一个已知的Andorid Bug
一个EditText, 只要调用了setMovementMethod(LinkMovementMethod.getInstance())对其设置,那么在获取焦点时,会崩掉。
01-06 07:59:08.669: E/AndroidRuntime(2421): Uncaught handler: thread main exiting due to uncaught exception 01-06 07:59:08.764: E/AndroidRuntime(2421): java.lang.IndexOutOfBoundsException: charAt: -2 < 0 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:110) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.text.TextUtils.getCapsMode(TextUtils.java:1573) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.view.inputmethod.BaseInputConnection.getCursorCapsMode(BaseInputConnection.java:273) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.widget.TextView.onCreateInputConnection(TextView.java:4482) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:942) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1114) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.view.inputmethod.InputMethodManager.onWindowFocus(InputMethodManager.java:1143) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.view.ViewRoot.handleMessage(ViewRoot.java:1829) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.os.Handler.dispatchMessage(Handler.java:99) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.os.Looper.loop(Looper.java:123) 01-06 07:59:08.764: E/AndroidRuntime(2421): at android.app.ActivityThread.main(ActivityThread.java:4363) 01-06 07:59:08.764: E/AndroidRuntime(2421): at java.lang.reflect.Method.invokeNative(Native Method) 01-06 07:59:08.764: E/AndroidRuntime(2421): at java.lang.reflect.Method.invoke(Method.java:521) 01-06 07:59:08.764: E/AndroidRuntime(2421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 01-06 07:59:08.764: E/AndroidRuntime(2421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 01-06 07:59:08.764: E/AndroidRuntime(2421): at dalvik.system.NativeStart.main(Native Method)