如何调试Android java.lang.IndexOutOfBoundsException HeaderViewListAdapter.java行

如何调试Android java.lang.IndexOutOfBoundsException HeaderViewListAdapter.java行,第1张

概述我有一个应用程序,它存在于 android playstore中,我最近开始看到来自Crashlytics的崩溃报告,其中包含以下跟踪: Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsExc 我有一个应用程序,它存在于 android playstore中,我最近开始看到来自Crashlytics的崩溃报告,其中包含以下跟踪:

Fatal Exception: java.lang.indexoutofboundsexception: InvalID index 0,size is 0   at java.util.ArrayList.throwindexoutofboundsexception(ArrayList.java:251)   at java.util.ArrayList.get(ArrayList.java:304)   at androID.Widget.headerVIEwlistadapter.isEnabled(headerVIEwlistadapter.java:164)   at androID.Widget.ListVIEw.dispatchDraw(ListVIEw.java:3259)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.Widget.AbsListVIEw.draw(AbsListVIEw.java:4960)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.Widget.FrameLayout.draw(FrameLayout.java:467)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13116)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.support.v4.Widget.DrawerLayout.drawChild(DrawerLayout.java:1229)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.Widget.FrameLayout.draw(FrameLayout.java:467)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.support.v7.internal.Widget.ActionbarOverlayLayout.draw(ActionbarOverlayLayout.java:500)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13116)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13116)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.VIEw.draw(VIEw.java:13896)   at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3024)   at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2893)   at androID.vIEw.VIEw.draw(VIEw.java:14183)   at androID.Widget.FrameLayout.draw(FrameLayout.java:467)   at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.draw(PhoneWindow.java:2449)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13118)   at androID.vIEw.VIEw.getdisplayList(VIEw.java:13162)   at androID.vIEw.HarDWareRenderer$glrenderer.draw(HarDWareRenderer.java:1198)   at androID.vIEw.VIEwRootImpl.draw(VIEwRootImpl.java:2431)   at androID.vIEw.VIEwRootImpl.performDraw(VIEwRootImpl.java:2303)   at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:2109)   at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:1179)   at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:4859)   at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java:749)   at androID.vIEw.Choreographer.doCallbacks(Choreographer.java:562)   at androID.vIEw.Choreographer.doFrame(Choreographer.java:532)   at androID.vIEw.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:735)   at androID.os.Handler.handleCallback(Handler.java:725)   at androID.os.Handler.dispatchMessage(Handler.java:92)   at androID.os.Looper.loop(Looper.java:137)   at androID.app.ActivityThread.main(ActivityThread.java:5328)   at java.lang.reflect.Method.invokeNative(Method.java)   at java.lang.reflect.Method.invoke(Method.java:511)   at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)   at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:869)   at dalvik.system.NativeStart.main(NativeStart.java)

我的应用程序有很多屏幕和视图,从这个跟踪没有框架来自我的应用程序:(我如何找出从哪里开始寻找?任何指针对此非常赞赏.

解决方法 覆盖getheadersCount()并在数据大小为0时始终返回0.

@OverrIDepublic int getheadersCount(){  return getCount() == 0 ? 0 : super.getheaderCount();}

当您具有非空数据列表并且它尝试访问0元素时会发生这种情况.

您也可能需要对isEnabled()方法执行相同的 *** 作

@OverrIDepublic boolean isEnabled(int position){  return position > 0 || getheadersCount() > 0 ? super.isEnabled(position) : false;}
总结

以上是内存溢出为你收集整理的如何调试Android java.lang.IndexOutOfBoundsException HeaderViewListAdapter.java行全部内容,希望文章能够帮你解决如何调试Android java.lang.IndexOutOfBoundsException HeaderViewListAdapter.java行所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1127980.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存