I found this library and it's exactly what I'm looking for. My arrays for header and items are parsed by JSON string, and I have a refresh button on my app. So whenever I press the refresh button, I need to clear the adapter to remove old data and insert new data. But I got the error below:
04-08 16:23:52.151: E/AndroidRuntime(26743): FATAL EXCEPTION: main
04-08 16:23:52.151: E/AndroidRuntime(26743): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
04-08 16:23:52.151: E/AndroidRuntime(26743): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
04-08 16:23:52.151: E/AndroidRuntime(26743): at java.util.ArrayList.get(ArrayList.java:308)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.pnminh.dfytask.adapter.ExpandableListAdapter.getChildrenCount(ExpandableListAdapter.java:94)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.WrapperExpandableListAdapter.getChildrenCount(WrapperExpandableListAdapter.java:49)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView.drawFloatingGroupIndicator(FloatingGroupExpandableListView.java:446)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView.dispatchDraw(FloatingGroupExpandableListView.java:171)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.widget.AbsListView.draw(AbsListView.java:5051)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.support.v4.view.ViewPager.draw(ViewPager.java:2171)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.widget.FrameLayout.draw(FrameLayout.java:467)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2621)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1411)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1359)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2677)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2541)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2156)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1251)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6379)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer.doCallbacks(Choreographer.java:591)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer.doFrame(Choreographer.java:561)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Handler.handleCallback(Handler.java:730)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Handler.dispatchMessage(Handler.java:92)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Looper.loop(Looper.java:137)
04-08 16:23:52.151: E/AndroidRuntime(26743): at android.app.ActivityThread.main(ActivityThread.java:5493)
04-08 16:23:52.151: E/AndroidRuntime(26743): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 16:23:52.151: E/AndroidRuntime(26743): at java.lang.reflect.Method.invoke(Method.java:525)
04-08 16:23:52.151: E/AndroidRuntime(26743): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit
Could you walk me through this problem? Thank you very much
I found this library and it's exactly what I'm looking for. My arrays for header and items are parsed by JSON string, and I have a refresh button on my app. So whenever I press the refresh button, I need to clear the adapter to remove old data and insert new data. But I got the error below:
04-08 16:23:52.151: E/AndroidRuntime(26743): FATAL EXCEPTION: main 04-08 16:23:52.151: E/AndroidRuntime(26743): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 04-08 16:23:52.151: E/AndroidRuntime(26743): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 04-08 16:23:52.151: E/AndroidRuntime(26743): at java.util.ArrayList.get(ArrayList.java:308) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.pnminh.dfytask.adapter.ExpandableListAdapter.getChildrenCount(ExpandableListAdapter.java:94) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.WrapperExpandableListAdapter.getChildrenCount(WrapperExpandableListAdapter.java:49) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView.drawFloatingGroupIndicator(FloatingGroupExpandableListView.java:446) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView.dispatchDraw(FloatingGroupExpandableListView.java:171) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.widget.AbsListView.draw(AbsListView.java:5051) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.support.v4.view.ViewPager.draw(ViewPager.java:2171) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13739) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14563) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.drawChild(ViewGroup.java:3316) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3153) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.draw(View.java:14856) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.widget.FrameLayout.draw(FrameLayout.java:467) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2621) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13744) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.View.getDisplayList(View.java:13786) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1411) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1359) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2677) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2541) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2156) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1251) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6379) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer.doCallbacks(Choreographer.java:591) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer.doFrame(Choreographer.java:561) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Handler.handleCallback(Handler.java:730) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Handler.dispatchMessage(Handler.java:92) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.os.Looper.loop(Looper.java:137) 04-08 16:23:52.151: E/AndroidRuntime(26743): at android.app.ActivityThread.main(ActivityThread.java:5493) 04-08 16:23:52.151: E/AndroidRuntime(26743): at java.lang.reflect.Method.invokeNative(Native Method) 04-08 16:23:52.151: E/AndroidRuntime(26743): at java.lang.reflect.Method.invoke(Method.java:525) 04-08 16:23:52.151: E/AndroidRuntime(26743): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit
Could you walk me through this problem? Thank you very much