zgkjzf 发表于 2020-4-5 10:20

android studio报错

这是有哪个listarry为空引起的,程序代码太多,都不知道从何下手。
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.time, PID: 20853
    java.lang.IndexOutOfBoundsException: Index: 3, Size: 0
      at java.util.ArrayList.get(ArrayList.java:437)
      at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:168)
      at android.widget.ListView.dispatchDraw(ListView.java:3524)
      at android.view.View.draw(View.java:21424)
      at android.widget.AbsListView.draw(AbsListView.java:4388)
      at android.view.View.updateDisplayListIfDirty(View.java:20298)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4372)
      at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4345)
      at android.view.View.updateDisplayListIfDirty(View.java:20258)
      at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:575)
      at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:581)
      at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:654)
      at android.view.ViewRootImpl.draw(ViewRootImpl.java:3610)
      at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3418)
      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2755)
      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
      at android.view.Choreographer.doCallbacks(Choreographer.java:790)
      at android.view.Choreographer.doFrame(Choreographer.java:725)
      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
      at android.os.Handler.handleCallback(Handler.java:883)
      at android.os.Handler.dispatchMessage(Handler.java:100)
      at android.os.Looper.loop(Looper.java:214)
      at android.app.ActivityThread.main(ActivityThread.java:7356)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process: Sending signal. PID: 20853 SIG: 9

HighBox 发表于 2020-4-5 10:42

楼主检查这个了吗?这是有一个listarry为空引起的,程序代码太多,都不知道从何下手

白薇 发表于 2020-4-5 10:43

at android.app.ActivityThread.main(ActivityThread.java:7356)
应该是这行吧?没代码,这看不懂啊{:1_904:}
你出错的那几行代码的行数应该有高亮的,点进去就找到了,行数是灰色的报错提示一般不用管吧?

wuwenyao 发表于 2020-4-5 11:03

数组超界异常,检查一下,数组的下标使用

zgkjzf 发表于 2020-4-5 11:19

wuwenyao 发表于 2020-4-5 11:03
数组超界异常,检查一下,数组的下标使用

是啊 就是没有提示是哪个 很郁闷 数组好多个

若墟 发表于 2020-4-5 11:21

典型的下标越界
页: [1]
查看完整版本: android studio报错