mukeshsolanki / android-otpview-pinview

A custom view to enter otp of different sizes used usually in cases of authentication.
MIT License
699 stars 207 forks source link

Getting app crashed on line 14 #132

Closed arsalanabrar-probo closed 2 years ago

arsalanabrar-probo commented 2 years ago

Fatal Exception: java.lang.RuntimeException Caused by java.lang.IndexOutOfBoundsException offset(6) should be less than line limit(0)

I have set the limit to 6 but on auto-read otp, it is crashing with this note.

mukeshsolanki commented 2 years ago

Can you please give more detail?

himawanmasyaid commented 2 years ago

I have same issues

Caused by java.lang.IndexOutOfBoundsException offset(4) should be less than line limit(0)

Fatal Exception: java.lang.RuntimeException : Error receiving broadcast Intent { act=com.google.android.gms.auth.api.phone.SMS_RETRIEVED

Crash Device and Library : on android version 12 device Samsung Galaxy Note20. version library used : com.github.mukeshsolanki:android-otpview-pinview:2.1.2

Crash location : com.mukesh.OtpView.moveSelectionToEnd (OtpView.java:258) com.mukesh.OtpView.onSelectionChanged (OtpView.java:252)

mukeshsolanki commented 2 years ago

@himawanmasyaid Can you please try the latest version(3.0.0) of the library

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

anderlipkin commented 1 year ago

Crash reproduces Library version 3.2.0 Android 13 Model: Galaxy M23 5G Log:

Fatal Exception: java.lang.IndexOutOfBoundsException: offset(6) should be less than line limit(0)
       at android.text.TextLine.measure(TextLine.java:389)
       at android.text.Layout.getHorizontal(Layout.java:1254)
       at android.text.Layout.getHorizontal(Layout.java:1230)
       at android.text.Layout.getPrimaryHorizontal(Layout.java:1200)
       at android.text.Layout.getPrimaryHorizontal(Layout.java:1189)
       at android.widget.Editor$TextActionModeCallback.onGetContentRect(Editor.java:5440)
       at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onGetContentRect(DecorView.java:5817)
       at com.android.internal.view.FloatingActionMode.invalidateContentRect(FloatingActionMode.java:161)
       at android.widget.Editor.refreshTextActionMode(Editor.java:2633)
       at android.widget.TextView.spanChange(TextView.java:12091)
       at android.widget.TextView$ChangeWatcher.onSpanChanged(TextView.java:15295)
       at android.text.SpannableStringBuilder.sendSpanChanged(SpannableStringBuilder.java:1321)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:766)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:690)
       at androidx.emoji2.text.SpannableBuilder.setSpan(SpannableBuilder.java:140)
       at android.text.Selection.setSelection(Selection.java:96)
       at android.text.Selection.setSelection(Selection.java:78)
       at android.text.Selection.setSelection(Selection.java:153)
       at android.widget.EditText.setSelection(EditText.java:147)
       at com.mukeshsolanki.OtpView.moveSelectionToEnd(OtpView.java:242)
       at com.mukeshsolanki.OtpView.onSelectionChanged(OtpView.java:236)
       at android.widget.TextView.spanChange(TextView.java:12098)
       at android.widget.TextView$ChangeWatcher.onSpanAdded(TextView.java:15302)
       at android.text.SpannableStringBuilder.sendSpanAdded(SpannableStringBuilder.java:1301)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:791)
       at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:690)
       at androidx.emoji2.text.SpannableBuilder.setSpan(SpannableBuilder.java:140)
       at android.text.Selection.setSelection(Selection.java:96)
       at android.text.Selection.setSelection(Selection.java:78)
       at android.text.Selection.setSelection(Selection.java:153)
       at com.mukeshsolanki.DefaultMovementMethod.initialize(DefaultMovementMethod.java:27)
       at android.widget.TextView.setText(TextView.java:6936)
       at android.widget.TextView.setText(TextView.java:6751)
       at android.widget.EditText.setText(EditText.java:133)
       at android.widget.TextView.setText(TextView.java:6703)
       at android.widget.TextViewOnReceiveContentListener.onReceiveForAutofill(TextViewOnReceiveContentListener.java:139)
       at android.widget.TextViewOnReceiveContentListener.onReceiveContent(TextViewOnReceiveContentListener.java:81)
       at android.widget.TextView.onReceiveContent(TextView.java:15352)
       at android.view.View.performReceiveContent(View.java:9624)
       at android.widget.TextView.autofill(TextView.java:13198)
       at android.view.autofill.AutofillManager.autofill(AutofillManager.java:2575)
       at android.view.autofill.AutofillManager.-$$Nest$mautofill()
       at android.view.autofill.AutofillManager$AutofillManagerClient.lambda$autofill$1(AutofillManager.java:3804)
       at android.view.autofill.AutofillManager$AutofillManagerClient$$ExternalSyntheticLambda2.run(:10)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)