Reputation: 39539
I am having a strange StackTrace in my Play-Console - I cannot reproduce the problem and it does not originate directly in my code. Perhaps someone here has an Idea on how to deal with this other than just ignoring it. Happened only once though - but I would really like to know what happened there.
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
at android.preference.ListPreference.getEntry(ListPreference.java:203)
at android.preference.ListPreference.getSummary(ListPreference.java:148)
at android.preference.Preference.onBindView(Preference.java:522)
at android.preference.Preference.getView(Preference.java:460)
at android.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:221)
at android.widget.AbsListView.obtainView(AbsListView.java:2308)
at android.widget.ListView.makeAndAddView(ListView.java:2030)
at android.widget.ListView.fillDown(ListView.java:822)
at android.widget.ListView.fillFromTop(ListView.java:883)
at android.widget.ListView.layoutChildren(ListView.java:1848)
at android.widget.AbsListView.onLayout(AbsListView.java:2136)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1652)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14177)
at android.view.ViewGroup.layout(ViewGroup.java:4399)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2244)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2017)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1190)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4860)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:766)
at android.view.Choreographer.doCallbacks(Choreographer.java:575)
at android.view.Choreographer.doFrame(Choreographer.java:542)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:751)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:5751)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
at dalvik.system.NativeStart.main(Native Method)
Upvotes: 2
Views: 716
Reputation: 1129
I am assuming you are using PreferenceActivity or PreferenceFragment(Compat)
seems like you are missing something in defining the ListPreference parameters in your preference xml file, I believe your android:entries and android:entryValues sizes are not matching.
Upvotes: 3
Reputation: 23638
Generally java.lang.ArrayIndexOutOfBoundsException:
error occurs whenever you are trying to access the which is larger or not in bounds (exceeded size) of arraylist.
So from the error as its showing java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
that sometimes its happening that you are trying to access the value greater than the size of your array. As your arraylist contains only total 3 records where as you might be trying to access the index at the 3 position. Whereas the array starts counting its values from index "0" so there would be the values like 0,1,2...
,So in that case it won't be able to get the value at index "3" not be available.
So "java.lang.ArrayIndexOutOfBoundsException: length=3; index=3"
. This means that the index you requested is outside the bounds of the array. In other words, the array has a length (it's bounds). When it's length is 3 (it's empty) and you ask for the 3st element, the array tells you the item you requested is unavailable because the array isn't even 3-element long.
Upvotes: 0