edittext-mask icon indicating copy to clipboard operation
edittext-mask copied to clipboard

Clear text causes java.lang.IndexOutOfBoundsException

Open Syjgin opened this issue 7 years ago • 2 comments

I want to clear field when incorrect digit typed (two-digit month field for credit card) When invoking monthCard.getText().clear(); there are such error:

FATAL EXCEPTION: main Process: ru.perekrestok.app, PID: 28172 java.lang.IndexOutOfBoundsException: setSpan (1 ... 1) ends beyond length 0 at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1309) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:680) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:672) at android.text.Selection.setSelection(Selection.java:76) at android.text.Selection.setSelection(Selection.java:87) at android.widget.EditText.setSelection(EditText.java:127) at br.com.sapereaude.maskedEditText.MaskedEditText.afterTextChanged(MaskedEditText.java:303)

Syjgin avatar Nov 28 '17 10:11 Syjgin

Anything new about this one? Happens to me as well with a simple EditText object, only workaround that I found was to call .setText("") For a numberPassword EditText field

slobglob avatar Feb 25 '18 13:02 slobglob

Hello, yes, will need to investigate. If you can help me with that - it would be nice, and I'll provide you all the info about how to build the source code, upload changes, test/debug and so on! Please, reach me out, if you're interested!

egslava avatar Sep 08 '19 12:09 egslava