gpt4 book ai didi

android - ArrayAdapter 和 ListView - ArrayIndexOutOfBoundsException

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:56:09 25 4
gpt4 key购买 nike

我真的希望有人能帮我解决这个问题。我一直坚持下去。有时,当有人使用我的应用程序时,它会强制关闭并出现以下异常:

java.lang.ArrayIndexOutOfBoundsException
at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:3572)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2487)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:2001)
at android.widget.ListView.onTouchEvent(ListView.java:3234)
at android.view.View.dispatchTouchEvent(View.java:3709)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:874)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1695)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1116)
at android.app.Activity.dispatchTouchEvent(Activity.java:2068)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1679)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1695)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1116)
at android.app.Activity.dispatchTouchEvent(Activity.java:2068)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1679)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1697)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4568)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)

但是,我想不通为什么。它相对罕见,不可重现,并且堆栈跟踪完全没有帮助,因为它不包含我的任何代码。

是不是Android本身的bug?

最佳答案

您运行的是哪个版本的 Android?据我所知,您的适配器从 getViewTypeCount() 返回了错误的计数(或者您正在动态更改 View 类型计数,这是一个很大的错误。)

关于android - ArrayAdapter 和 ListView - ArrayIndexOutOfBoundsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3017496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com