java.lang.IndexOutOfBoundsException

Invalid index 2, size is 2


Samebug tips1

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. Applications can subclass this class to indicate similar exceptions.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.


Solutions on the web7391

Solution icon of github
via GitHub by cletus42o
, 1 year ago
Invalid index 2, size is 2

Solution icon of github
Invalid index 2, size is 2

Solution icon of github
Invalid index 2, size is 2

Solution icon of github
via GitHub by kxs109
, 9 months ago
Invalid index 2, size is 2

Solution icon of googlegroups
via Google Groups by Dante vd merwe, 1 month ago
Invalid index 2, size is 2

Solution icon of stackoverflow
via Stack Overflow by Sultan
, 1 year ago
Invalid index 2, size is 2

Solution icon of stackoverflow
via Stack Overflow by Unknown author, 1 year ago
Invalid index 2, size is 2

Solution icon of stackoverflow
via Stack Overflow by Unknown author, 1 year ago
Invalid index 2, size is 2

Solution icon of stackoverflow
Invalid index 2, size is 2

Solution icon of stackoverflow
Invalid index 2, size is 2

Stack trace

  • java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.notadeveloper.app.sgnpharmacy.CartAdapter.onBindViewHolder(CartAdapter.java:66) at com.notadeveloper.app.sgnpharmacy.CartAdapter.onBindViewHolder(CartAdapter.java:31) at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6308) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6341) at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5287) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5550) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5392) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5388) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2149) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1533) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1496) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:593) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3535) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:2979) at android.view.View.measure(View.java:18807) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:716) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:462) at android.view.View.measure(View.java:18807) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1283) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.widget.ScrollView.onMeasure(ScrollView.java:340) at android.view.View.measure(View.java:18807) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:18807) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:393) at android.view.View.measure(View.java:18807) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18807) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458) at android.widget.LinearLayout.measureVertical(LinearLayout.java:746) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(View.java:18807) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5952) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643) at android.view.View.measure(View.java:18807) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2108) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1224) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1460) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:606) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) at android.os.Handler.handleCallback(Handler.java:739)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

2 times, 1 week ago
3 times, 2 months ago
81 times, 2 months ago
Samebug visitor profile picture
Unknown user
Once, 4 months ago
4 times, 5 months ago
244 more bugmates