java.lang.ArrayIndexOutOfBoundsException: length=4; index=4 #7
Labels
No Label
dependencies
info:feedback-needed
info:help-needed
prio:high
prio:low
prio:normal
status:confirmed
status:deferred
status:fix-committed
status:incomplete
status:in-progress
status:rejected
type:bug
type:discussion
type:feature
type:improvement
type:invalid
type:support
type:task
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Marown/SWADroid#7
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
at es.ugr.swad.swadroid.modules.notifications.NotificationsCursorAdapter.bindView(NotificationsCursorAdapter.java:229)
at android.widget.CursorAdapter.getView(CursorAdapter.java:250)
at android.widget.AbsListView.obtainView(AbsListView.java:2445)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1250)
at android.widget.ListView.onMeasure(ListView.java:1162)
at android.view.View.measure(View.java:15473)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5056)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15473)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5056)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15473)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5056)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15473)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5056)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2361)
at android.view.View.measure(View.java:15473)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1974)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1217)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1390)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
I also have this question. Could you talk about how to fix it, or how it happened? Thanks so much!
Hi @lu-ym.
I'm using the cursor position as an index to access an array the same size as the result set. When the cursor reaches the end of the result set, the cursor position is END + 1.
At this time, the array is accessed through the
array[END + 1]
sentence, whose index is outside the bounds of the array, and an exception ArrayIndexOutOfBoundsException occurs.As you can see in the commit
1c59e4f
, I fixed it by checking the index value before accessing the array.