我正在尝试expandable list
从数据库创建三个级别。它可以工作到第二级。但是当我在某个时候选择第三级时,它会给出如下错误。我们发现它是因为数组值(但结果数组可以有值)。所以请检查并恢复解决方案。
错误
05-03 12:06:17.990: E/AndroidRuntime(399): Uncaught handler: thread main exiting due to uncaught exception
05-03 12:06:18.010: E/AndroidRuntime(399): java.lang.IndexOutOfBoundsException: Invalid location 0, size is 0
05-03 12:06:18.010: E/AndroidRuntime(399): at java.util.ArrayList.get(ArrayList.java:341)
05-03 12:06:18.010: E/AndroidRuntime(399): at com.example.home.MainActivity$SecondLevelAdapter.getChildView(MainActivity.java:270)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:451)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.AbsListView.obtainView(AbsListView.java:1256)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.makeAndAddView(ListView.java:1668)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.fillDown(ListView.java:637)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.fillSpecific(ListView.java:1224)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.layoutChildren(ListView.java:1499)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.AbsListView.onLayout(AbsListView.java:1113)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.setupChild(ListView.java:1755)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.makeAndAddView(ListView.java:1661)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.fillSpecific(ListView.java:1212)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.ListView.layoutChildren(ListView.java:1532)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.AbsListView.onLayout(AbsListView.java:1113)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.View.layout(View.java:6830)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.ViewRoot.performTraversals(ViewRoot.java:996)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.os.Looper.loop(Looper.java:123)
05-03 12:06:18.010: E/AndroidRuntime(399): at android.app.ActivityThread.main(ActivityThread.java:4363)
05-03 12:06:18.010: E/AndroidRuntime(399): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 12:06:18.010: E/AndroidRuntime(399): at java.lang.reflect.Method.invoke(Method.java:521)
05-03 12:06:18.010: E/AndroidRuntime(399): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-03 12:06:18.010: E/AndroidRuntime(399): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-03 12:06:18.010: E/AndroidRuntime(399): at dalvik.system.NativeStart.main(Native Method)