New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于ExpandableListView问题 #678

Closed
a7891749 opened this Issue Dec 28, 2016 · 13 comments

Comments

Projects
None yet
5 participants
@a7891749

a7891749 commented Dec 28, 2016

当你展开第一级伸展栏,然后关闭同时快速点击第二级伸展栏会奔溃。
望修复。

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman

elfman Dec 28, 2016

Collaborator

能否把你的错误日志发一下

Collaborator

elfman commented Dec 28, 2016

能否把你的错误日志发一下

@liuguoquan727

This comment has been minimized.

Show comment
Hide comment
@liuguoquan727

liuguoquan727 Dec 29, 2016

helper D/ExpandableItemAdapter: Level 0 item pos: 1
12-29 14:33:11.184 13721-13721/com.chad.baserecyclerviewadapterhelper D/ExpandableItemAdapter: Level 1 item pos: -1
12-29 14:33:11.184 13721-13721/com.chad.baserecyclerviewadapterhelper D/AndroidRuntime: Shutting down VM
12-29 14:33:11.186 13721-13721/com.chad.baserecyclerviewadapterhelper E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.chad.baserecyclerviewadapterhelper, PID: 13721
java.lang.ArrayIndexOutOfBoundsException: length=24; index=-1
at java.util.ArrayList.get(ArrayList.java:310)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:392)
at com.chad.library.adapter.base.BaseQuickAdapter.getExpandableItem(BaseQuickAdapter.java:1324)
at com.chad.library.adapter.base.BaseQuickAdapter.collapse(BaseQuickAdapter.java:1272)
at com.chad.library.adapter.base.BaseQuickAdapter.collapse(BaseQuickAdapter.java:1307)
at com.chad.baserecyclerviewadapterhelper.adapter.ExpandableItemAdapter$2.onClick(ExpandableItemAdapter.java:76)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

liuguoquan727 commented Dec 29, 2016

helper D/ExpandableItemAdapter: Level 0 item pos: 1
12-29 14:33:11.184 13721-13721/com.chad.baserecyclerviewadapterhelper D/ExpandableItemAdapter: Level 1 item pos: -1
12-29 14:33:11.184 13721-13721/com.chad.baserecyclerviewadapterhelper D/AndroidRuntime: Shutting down VM
12-29 14:33:11.186 13721-13721/com.chad.baserecyclerviewadapterhelper E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.chad.baserecyclerviewadapterhelper, PID: 13721
java.lang.ArrayIndexOutOfBoundsException: length=24; index=-1
at java.util.ArrayList.get(ArrayList.java:310)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:392)
at com.chad.library.adapter.base.BaseQuickAdapter.getExpandableItem(BaseQuickAdapter.java:1324)
at com.chad.library.adapter.base.BaseQuickAdapter.collapse(BaseQuickAdapter.java:1272)
at com.chad.library.adapter.base.BaseQuickAdapter.collapse(BaseQuickAdapter.java:1307)
at com.chad.baserecyclerviewadapterhelper.adapter.ExpandableItemAdapter$2.onClick(ExpandableItemAdapter.java:76)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

@proud2008

This comment has been minimized.

Show comment
Hide comment
@proud2008

proud2008 Dec 30, 2016

如何展开第二列时,把上步展开的关闭

proud2008 commented Dec 30, 2016

如何展开第二列时,把上步展开的关闭

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman

elfman Dec 30, 2016

Collaborator

@liuguoquan727 我这里测试没有问题啊,重现不了

Collaborator

elfman commented Dec 30, 2016

@liuguoquan727 我这里测试没有问题啊,重现不了

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman
Collaborator

elfman commented Dec 30, 2016

@a7891749

This comment has been minimized.

Show comment
Hide comment
@a7891749

a7891749 Dec 31, 2016

需要快速点击才行 @elfman
在第二级还没消失前 点击

a7891749 commented Dec 31, 2016

需要快速点击才行 @elfman
在第二级还没消失前 点击

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman

elfman Dec 31, 2016

Collaborator

@a7891749 我在demo上测是没问题的,你看下你代码逻辑有没有问题?

Collaborator

elfman commented Dec 31, 2016

@a7891749 我在demo上测是没问题的,你看下你代码逻辑有没有问题?

@a7891749

This comment has been minimized.

Show comment
Hide comment
@a7891749

a7891749 Dec 31, 2016

@elfman 我先看看最新的demo

a7891749 commented Dec 31, 2016

@elfman 我先看看最新的demo

@a7891749

This comment has been minimized.

Show comment
Hide comment
@a7891749

a7891749 Dec 31, 2016

@elfman 我刚刚测试2.0的demo 还有闪退
再跟你说流程
1.点击第一级 菜单 然后出现了第二级菜单
2.再次点击第一级菜单 这时候就会 把 二级菜单 隐藏 ,因为有个动画所以不是马上隐藏的。所以只要手速过快还是可以二级菜单的

a7891749 commented Dec 31, 2016

@elfman 我刚刚测试2.0的demo 还有闪退
再跟你说流程
1.点击第一级 菜单 然后出现了第二级菜单
2.再次点击第一级菜单 这时候就会 把 二级菜单 隐藏 ,因为有个动画所以不是马上隐藏的。所以只要手速过快还是可以二级菜单的

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman

elfman Dec 31, 2016

Collaborator

@a7891749 虽然我还是重现不了,但看你上面的错误日志也猜到错误原因是什么了,在collapse里加个判断position<0时的处理应该就行了。或者说是collapse就不应该接受小于0的值

Collaborator

elfman commented Dec 31, 2016

@a7891749 虽然我还是重现不了,但看你上面的错误日志也猜到错误原因是什么了,在collapse里加个判断position<0时的处理应该就行了。或者说是collapse就不应该接受小于0的值

@a7891749

This comment has been minimized.

Show comment
Hide comment
@a7891749

a7891749 Dec 31, 2016

@elfman
FATAL EXCEPTION: main
Process: com.chad.baserecyclerviewadapterhelper, PID: 21855
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at java.util.ArrayList.get(ArrayList.java:315)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:392)
at com.chad.library.adapter.base.BaseQuickAdapter.getExpandableItem(BaseQuickAdapter.java:1324)
at com.chad.library.adapter.base.BaseQuickAdapter.expand(BaseQuickAdapter.java:1139)
at com.chad.library.adapter.base.BaseQuickAdapter.expand(BaseQuickAdapter.java:1176)
at com.chad.baserecyclerviewadapterhelper.adapter.ExpandableItemAdapter$2.onClick(ExpandableItemAdapter.java:90)
at android.view.View.performClick(View.java:5317)
at android.view.View$PerformClick.run(View.java:21648)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5925)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:956)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:817)

a7891749 commented Dec 31, 2016

@elfman
FATAL EXCEPTION: main
Process: com.chad.baserecyclerviewadapterhelper, PID: 21855
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at java.util.ArrayList.get(ArrayList.java:315)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:392)
at com.chad.library.adapter.base.BaseQuickAdapter.getExpandableItem(BaseQuickAdapter.java:1324)
at com.chad.library.adapter.base.BaseQuickAdapter.expand(BaseQuickAdapter.java:1139)
at com.chad.library.adapter.base.BaseQuickAdapter.expand(BaseQuickAdapter.java:1176)
at com.chad.baserecyclerviewadapterhelper.adapter.ExpandableItemAdapter$2.onClick(ExpandableItemAdapter.java:90)
at android.view.View.performClick(View.java:5317)
at android.view.View$PerformClick.run(View.java:21648)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5925)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:956)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:817)

@elfman

This comment has been minimized.

Show comment
Hide comment
@elfman

elfman Dec 31, 2016

Collaborator

你在getExpandableItem里判断一下position小于0时直接return null;
我这里重现不了,只能你来试了
如下面代码:

    private IExpandable getExpandableItem(int position) {
        if (position < 0) {
            return null;
        }
        T item = getItem(position);
        if (isExpandable(item)) {
            return (IExpandable) item;
        } else {
            return null;
        }
    }
Collaborator

elfman commented Dec 31, 2016

你在getExpandableItem里判断一下position小于0时直接return null;
我这里重现不了,只能你来试了
如下面代码:

    private IExpandable getExpandableItem(int position) {
        if (position < 0) {
            return null;
        }
        T item = getItem(position);
        if (isExpandable(item)) {
            return (IExpandable) item;
        } else {
            return null;
        }
    }

CymChad pushed a commit that referenced this issue Jan 1, 2017

@CymChad

This comment has been minimized.

Show comment
Hide comment
@CymChad

CymChad Jan 1, 2017

Owner

com.github.CymChad:BaseRecyclerViewAdapterHelper:2.7.2

Owner

CymChad commented Jan 1, 2017

com.github.CymChad:BaseRecyclerViewAdapterHelper:2.7.2

@CymChad CymChad closed this Jan 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment