Android的HeaderViewListAdapter中的OutOfBounds异常

时间:2016-10-05 05:58:05

标签: android listview listadapter

我有一个扩展 BaseExpandableListAdapter 的适配器,我附加了一个页脚和一个标题。适配器的内容是 ExpandableListView

在我的所有测试中,它似乎在大多数情况下工作得很好。但是,我可以看到一些人发生了几次崩溃。

崩溃日志指向 HeaderViewListAdapter 第164行。 我无法弄清楚问题,以及为什么它只是相对很少发生。我也无法自己重建崩溃。

(但我注意到所有崩溃都在 Android 6.0 / 6.0.1 上)

崩溃似乎出现在第164行中的 HeaderViewListAdapter 代码中,即:

// Footer (off-limits positions will throw an IndexOutOfBoundsException)
return mFooterViewInfos.get(adjPosition - adapterCount).isSelectable;
  java.util.ArrayList.throwIndexOutOfBoundsException (ArrayList.java:255)
        java.util.ArrayList.get (ArrayList.java:308)
        android.widget.HeaderViewListAdapter.isEnabled (HeaderViewListAdapter.java:164)
        android.widget.AbsListView.onInitializeAccessibilityNodeInfoForItem (AbsListView.java:2525)
        android.widget.ListView.onInitializeAccessibilityNodeInfoForItem (ListView.java:3949)
        android.widget.AbsListView$ListItemAccessibilityDelegate.onInitializeAccessibilityNodeInfo (AbsListView.java:2452)
        android.view.View.onInitializeAccessibilityNodeInfo (View.java:6079)
        android.view.View.createAccessibilityNodeInfoInternal (View.java:6040)
        android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo (View.java:22348)
        android.view.View.createAccessibilityNodeInfo (View.java:6023)
        android.view.accessibility.AccessibilityRecord.setSource (AccessibilityRecord.java:145)
        android.view.accessibility.AccessibilityRecord.setSource (AccessibilityRecord.java:119)
        android.view.View.onInitializeAccessibilityEventInternal (View.java:5977)
        android.view.View$AccessibilityDelegate.onInitializeAccessibilityEvent (View.java:22260)
        android.view.View.onInitializeAccessibilityEvent (View.java:5963)
        android.view.View.sendAccessibilityEventUncheckedInternal (View.java:5830)
        android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked (View.java:22199)
        android.view.View.sendAccessibilityEventUnchecked (View.java:5813)
        android.view.View.sendAccessibilityEventInternal (View.java:5792)
        android.view.View$AccessibilityDelegate.sendAccessibilityEvent (View.java:22157)
        android.view.View.sendAccessibilityEvent (View.java:5757)
        android.view.View.performClick (View.java:5207)
        android.view.View$PerformClick.run (View.java:21209)
        android.os.Handler.handleCallback (Handler.java:739)
        android.os.Handler.dispatchMessage (Handler.java:95)
        android.os.Looper.loop (Looper.java:148)
        android.app.ActivityThread.main (ActivityThread.java:5525)
        java.lang.reflect.Method.invoke (Method.java)
        com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:730)
        com.android.internal.os.ZygoteInit.main (ZygoteInit.java:620)

0 个答案:

没有答案