Skip to content Skip to sidebar Skip to footer

Android Android.database.CursorIndexOutOfBoundsException: Index 2 Requested, With A Size Of 2

I have this log 07-27 21:42:05.635: ERROR/AndroidRuntime(26094): FATAL EXCEPTION: main 07-27 21:42:05.635: ERROR/AndroidRuntime(26094): android.database.CursorIndexOutOfBoundsExcep

Solution 1:

That means you are accessing an item that does not exist. Think of it like this: A cursor has a certain number of rows (the data you want to access), these rows are Zero-indexed, meaning that if there are 10 rows of data, the first row of data is Index 0, and the 10th row (the last available value) is Index 9 not Index 10 - Index 10 does not exist.

Your problem is exactly due to this, you have a cursor of two rows (index 0 through 1), and you are attempting to access index 2 (a third item that simply isn't there), therefore you get an exception thrown.

Hope that helped.


Post a Comment for "Android Android.database.CursorIndexOutOfBoundsException: Index 2 Requested, With A Size Of 2"