gpt4 book ai didi

android - 带有 TitlepageIndicator Strage indexoutofbound 异常的 ListView

转载 作者:行者123 更新时间:2023-11-29 17:57:57 26 4
gpt4 key购买 nike

我的 View 寻呼机中有 ListView ,并且我使用了 TitlePageIndicator。一切似乎都运行良好,但由于 IndexOutOfBound 异常而随机崩溃。我不确定是什么原因造成的。下面我附上了它的堆栈跟踪。我也找到了this link它提到这已在 2.1.0 中修复。但是我用的是2.3.1版本。

`

> 07-31 15:32:10.242: W/System.err(6720): java.lang.IndexOutOfBoundsException: Invalid index 4, size is 1
07-31 15:32:10.247: W/System.err(6720): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
07-31 15:32:10.247: W/System.err(6720): at java.util.ArrayList.get(ArrayList.java:304)
07-31 15:32:10.247: W/System.err(6720): at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:225)
07-31 15:32:10.247: W/System.err(6720): at android.widget.AbsListView.obtainView(AbsListView.java:2452)
07-31 15:32:10.247: W/System.err(6720): at android.widget.ListView.makeAndAddView(ListView.java:1775)
07-31 15:32:10.247: W/System.err(6720): at android.widget.ListView.fillDown(ListView.java:678)
07-31 15:32:10.247: W/System.err(6720): at android.widget.ListView.fillSpecific(ListView.java:1336)
07-31 15:32:10.247: W/System.err(6720): at android.widget.ListView.layoutChildren(ListView.java:1606)
07-31 15:32:10.247: W/System.err(6720): at android.widget.AbsListView.onLayout(AbsListView.java:2303)
07-31 15:32:10.247: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.247: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.247: W/System.err(6720): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
07-31 15:32:10.247: W/System.err(6720): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
07-31 15:32:10.247: W/System.err(6720): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
07-31 15:32:10.247: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.247: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.247: W/System.err(6720): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
07-31 15:32:10.247: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.247: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.247: W/System.err(6720): at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1520)
07-31 15:32:10.247: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.247: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.247: W/System.err(6720): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
07-31 15:32:10.252: W/System.err(6720): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
07-31 15:32:10.252: W/System.err(6720): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
07-31 15:32:10.252: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.252: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.252: W/System.err(6720): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
07-31 15:32:10.252: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.252: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.252: W/System.err(6720): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
07-31 15:32:10.252: W/System.err(6720): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
07-31 15:32:10.257: W/System.err(6720): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
07-31 15:32:10.257: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.257: W/System.err(6720): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
07-31 15:32:10.257: W/System.err(6720): at android.view.View.layout(View.java:14063)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewGroup.layout(ViewGroup.java:4655)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2017)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1838)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1131)
07-31 15:32:10.257: W/System.err(6720): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4611)
07-31 15:32:10.257: W/System.err(6720): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
07-31 15:32:10.257: W/System.err(6720): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
07-31 15:32:10.257: W/System.err(6720): at android.view.Choreographer.doFrame(Choreographer.java:525)
07-31 15:32:10.257: W/System.err(6720): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
07-31 15:32:10.257: W/System.err(6720): at android.os.Handler.handleCallback(Handler.java:615)
07-31 15:32:10.257: W/System.err(6720): at android.os.Handler.dispatchMessage(Handler.java:92)
07-31 15:32:10.257: W/System.err(6720): at android.os.Looper.loop(Looper.java:137)
07-31 15:32:10.257: W/System.err(6720): at android.app.ActivityThread.main(ActivityThread.java:4898)
07-31 15:32:10.257: W/System.err(6720): at java.lang.reflect.Method.invokeNative(Native Method)
07-31 15:32:10.257: W/System.err(6720): at java.lang.reflect.Method.invoke(Method.java:511)
07-31 15:32:10.257: W/System.err(6720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
07-31 15:32:10.257: W/System.err(6720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
07-31 15:32:10.257: W/System.err(6720): at dalvik.system.NativeStart.main(Native Method)

`

最佳答案

如果没有看到一些代码,很难确定您的确切问题,但让我尝试进行有根据的猜测。

您是否有可能通过在 ListView 上手动调用 getAdapter() 来访问您的适配器?

如果是这样,当您最初设置适配器时,不要调用 getAdapter(),而是在新的类变量中保留对它的引用。然后,当您需要它时,使用您的新变量访问它。

关于android - 带有 TitlepageIndicator Strage indexoutofbound 异常的 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17968234/

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