gpt4 book ai didi

java.lang.IndexOutOfBoundsException : setSpan (5 . .. 5) 在设备后退按钮按下时结束超过长度 0

转载 作者:行者123 更新时间:2023-11-29 04:16:42 27 4
gpt4 key购买 nike

在返回时,我得到一个错误“java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 0” 我不明白我在哪里得到这个错误。当我通过设备后退按钮并来到 fragment 页面 (FragmentPageA) 时,会发生此错误。如果我通过点击菜单来到同一页面 (FragmentPageA),我不会收到相同的错误。

    08-19 17:00:42.119 1252-1252/com.shidhin.ts E/UncaughtException: java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 0
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1265)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:684)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:677)
at android.text.Selection.setSelection(Selection.java:76)
at android.widget.TextView.semSetSelection(TextView.java:11549)
at android.widget.EditText.setSelection(EditText.java:118)
at android.widget.NumberPicker$SetSelectionCommand.run(NumberPicker.java:2246)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
08-19 17:00:42.388 1252-1252/com.shidhin.ts E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.shidhin.ts, PID: 1252
java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 0
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1265)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:684)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:677)
at android.text.Selection.setSelection(Selection.java:76)
at android.widget.TextView.semSetSelection(TextView.java:11549)
at android.widget.EditText.setSelection(EditText.java:118)
at android.widget.NumberPicker$SetSelectionCommand.run(NumberPicker.java:2246)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

这是我在 Activity 页面上的返回代码,

@Override
public void onBackPressed() {
if (drawerLayout.isDrawerOpen(menuLayout))
drawerLayout.closeDrawer(menuLayout);
else {
if (getFragmentManager() != null && getFragmentManager().getBackStackEntryCount() != 0) {
getFragmentManager().popBackStack();
} else
showExitConfirmationDialog();
}
}

最佳答案

看起来其他人也有同样的问题here

NumberPicker.setSaveFromParentEnabled(false);       
NumberPicker.setSaveEnabled(false);

关于java.lang.IndexOutOfBoundsException : setSpan (5 . .. 5) 在设备后退按钮按下时结束超过长度 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51918478/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com