Wednesday, August 3, 2011

[android-developers] Problem getting string from database

Hi,
I'm trying to get a string from my database. My cursor gets the right
row and everything, and there is no problem to get the columnIndex.
But when I use "getString" I get this exception in logcat:

08-03 14:27:42.974: ERROR/AndroidRuntime(31026): Caused by:
android.database.CursorIndexOutOfBoundsException: Index 0 requested,
with a size of 0

this is the code I have.

Cursor cursor = (Cursor) mDbHelper.fetchNote(row);
startManagingCursor(cursor);
if (cursor != null) {

addTitle.setText(cursor.getString(cursor.getColumnIndexOrThrow(DbAdapter.KEY_TITLE)));
}

Any suggestions?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment