Crash at startup
dmarcato opened this issue · 5 comments
I have implemented PullToRefreshView in my project but sometimes at startup the app crashes with the following log:
10-24 13:16:29.067: E/AndroidRuntime(3667): FATAL EXCEPTION: main
10-24 13:16:29.067: E/AndroidRuntime(3667): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
10-24 13:16:29.067: E/AndroidRuntime(3667): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
10-24 13:16:29.067: E/AndroidRuntime(3667): at java.util.ArrayList.get(ArrayList.java:311)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.widget.ListView.dispatchDraw(ListView.java:3061)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.View.draw(View.java:7003)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.widget.AbsListView.draw(AbsListView.java:2641)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.View.draw(View.java:6900)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.View.draw(View.java:6900)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.widget.FrameLayout.draw(FrameLayout.java:357)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.View.draw(View.java:6900)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.widget.FrameLayout.draw(FrameLayout.java:357)
10-24 13:16:29.067: E/AndroidRuntime(3667): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1908)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewRoot.draw(ViewRoot.java:1527)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.os.Looper.loop(Looper.java:130)
10-24 13:16:29.067: E/AndroidRuntime(3667): at android.app.ActivityThread.main(ActivityThread.java:3835)
10-24 13:16:29.067: E/AndroidRuntime(3667): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 13:16:29.067: E/AndroidRuntime(3667): at java.lang.reflect.Method.invoke(Method.java:507)
10-24 13:16:29.067: E/AndroidRuntime(3667): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
10-24 13:16:29.067: E/AndroidRuntime(3667): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-24 13:16:29.067: E/AndroidRuntime(3667): at dalvik.system.NativeStart.main(Native Method)
Is there someting I am doing wrong? I have added the widget in my xml and set adapter in onCreate...
Hi, thank you for the report. It's hard to tell from the crash why this occurs. Can you provide an example app that triggers this or a description of how to trigger it in the example app?
Well I have investigate more and it seems that the problems occurs when i wrap my adapter into an EndlessAdapter from CWAC (https://github.com/commonsguy/cwac-endless) and give it to the PullToRefresh view, so I'm not sure if it's a problem of Endless wrapper or a problem of PullToRefresh.
I will try to report more info and log...
Closing this for now.
FATAL EXCEPTION: main
Process: com.juyoulicai.debug, PID: 11699
java.lang.IndexOutOfBoundsException: Invalid index 13, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:237)
at android.widget.AbsListView.obtainView(AbsListView.java:2361)
at android.widget.ListView.makeAndAddView(ListView.java:1868)
at android.widget.ListView.fillDown(ListView.java:702)
at android.widget.ListView.fillGap(ListView.java:666)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5063)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4607)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:793)
at android.view.Choreographer.doCallbacks(Choreographer.java:606)
at android.view.Choreographer.doFrame(Choreographer.java:574)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:779)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5595)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
@AllenCoder Thanks for the report, this library is deprecated though so keeping this as closed. I would suggest you to migrate to one of the alternative libraries listed in the readme instead.