java.lang.IndexOutOfBoundsException: getChars (-1 ... 0) starts before 0

GitHub | billdacat | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    GitHub comment 6#241237053

    GitHub | 7 months ago | billdacat
    java.lang.IndexOutOfBoundsException: getChars (-1 ... 0) starts before 0
  2. 0

    Error java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 in fragment by viewPager

    Stack Overflow | 7 months ago | Nabia Saroosh
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.example.saroosh.masjidnow.Tabs.AddMasjid$1.onClick(AddMasjid.java:61) at android.view.View.performClick(View.java:5184) at android.view.View$PerformClick.run(View.java:20910) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5942) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)

    Root Cause Analysis

    1. java.lang.IndexOutOfBoundsException

      getChars (-1 ... 0) starts before 0

      at android.text.SpannableStringBuilder.checkRange()
    2. Android Platform
      BaseInputConnection.getSelectedText
      1. android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1270)
      2. android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:1147)
      3. android.text.TextUtils.getChars(TextUtils.java:89)
      4. android.text.TextUtils.substring(TextUtils.java:280)
      5. android.view.inputmethod.BaseInputConnection.getSelectedText(BaseInputConnection.java:531)
      5 frames
    3. Android
      IInputConnectionWrapper$MyHandler.handleMessage
      1. com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:300)
      2. com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:91)
      2 frames
    4. Android Platform
      ActivityThread.main
      1. android.os.Handler.dispatchMessage(Handler.java:102)
      2. android.os.Looper.loop(Looper.java:154)
      3. android.app.ActivityThread.main(ActivityThread.java:6077)
      3 frames
    5. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    6. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
      2 frames