ArrayAdapter和ListView - ArrayIndexOutOfBoundsException异常 [英] ArrayAdapter and ListView - ArrayIndexOutOfBoundsException
问题描述
我真的希望有人能帮助我这一个。我一直坚持它永远。偶尔,当有人使用我的应用程序,它会强制关闭与此异常:
I'm really hoping someone can help me out with this one. I've been stuck on it forever. Occasionally, when someone is using my app, it'll force close with this exception:
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)
不过,我想不通这是为什么。这是比较少见的,非可再现,且堆栈跟踪是完全无用的,因为它不包括我的任何code。
However, I cannot figure out why. It's relatively rare, non-reproducable, and the stacktrace is completely unhelpful because it doesn't include any of my code.
是它的Android本身?
Is it a bug in Android itself?
推荐答案
您运行的是什么版本的Android?从我可以告诉你的适配器返回从getViewTypeCount(错误计数)(或您要更改视图类型动态计数这是一个很大的错误。)
What version of Android are you running? From what I can tell your Adapter is returning the wrong count from getViewTypeCount() (or you are changing the view type count dynamically which is a big mistake.)
这篇关于ArrayAdapter和ListView - ArrayIndexOutOfBoundsException异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!