I have a problem with this part of code. I'm writing an app that should parse an xml and add parsed data to a db, checking (If the row is already present) if a certain parsed value (an md5) is equal to the md5 already present in the db.This is the part of code that causes problems:
- Code: Select all
Cursor pCursor = Contacts.ProfilemDbHelper.fetchMd5(ManageContact.SubStringJid(getJid()));
Log.v("CURSOR", String.valueOf(pCursor.getCount()));
String pMd5 = pCursor.getString(pCursor.getColumnIndex(ProfileDbAdapter.KEY_MD5));
The problem is that when program arrive to pCursor.getString I receive in the LogCat this error:
- Code: Select all
12-18 10:19:03.961: VERBOSE/CURSOR(189): 1
12-18 10:19:03.971: VERBOSE/PARSECONTACT(189): Error: Index -1 requested, with a size of 1
Contacts is the activity where I work, but this part of code is in another class (The class of parsedData).The first row in the logCat returns 1, that is the number of rows in the cursor, so I'm sure that the row is already present. The second row in logcat is the error I receive, and I don't know how to solve it, because pCursor.getColumnIndex return the right value. Any ideas?
Please help me, it's quite urgent.


