splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 383 forks source link

Problem with splitchar #346

Closed LuigiMaestrelli closed 5 years ago

LuigiMaestrelli commented 6 years ago

I'm facing some erros then added a blank space to the aplitChar option.

        char[] splitChar = {',', ';', ' '};
        completionView.setSplitChar(splitChar);

Like this exception:

03-29 14:39:08.823 14932-14932/com.tokenautocomplete E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.tokenautocomplete, PID: 14932
    java.lang.IndexOutOfBoundsException: charAt: 7 >= length 7
        at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:123)
        at com.tokenautocomplete.CharacterTokenizer.findTokenStart(CharacterTokenizer.java:31)
        at com.tokenautocomplete.TokenCompleteTextView.getCorrectedTokenBeginning(TokenCompleteTextView.java:517)
        at com.tokenautocomplete.TokenCompleteTextView.enoughToFilter(TokenCompleteTextView.java:573)
        at android.widget.AutoCompleteTextView.doAfterTextChanged(AutoCompleteTextView.java:892)
        at android.widget.AutoCompleteTextView$MyWatcher.afterTextChanged(AutoCompleteTextView.java:860)
        at android.widget.TextView.sendAfterTextChanged(TextView.java:9380)
        at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:11939)
        at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1262)
        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:574)
        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:504)
        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:502)
        at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:843)
        at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:197)
        at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:183)
        at android.view.inputmethod.InputConnectionWrapper.commitText(InputConnectionWrapper.java:158)
        at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:341)
        at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:85)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

And the fact that the hint is showed like a text. Probably because the hint has a blank space.

mgod commented 5 years ago

I believe this is resolved in 3.0.0.