Skip to content Skip to sidebar Skip to footer

Java.lang.illegalstateexception: Couldn't Read Row 0, Col -1 From Cursorwindow - Android Sqlite Issue

I am trying to fetch two values from a table in sqlite db in android. I get the following exception: 05-22 04:13:05.432: I/ActivityManager(251): app/com.nykkos.personalize[INITIAL]

Solution 1:

The third line is the problem. See your logcat output and the Android sources (search within the sources for "requesting column name with table name"). Now have a look at your logcat output. The line with this sentence contains the column name you are requesting: /mnt/sdcard/googleCheckout/Saxo Trader.apk. This value is coming from your result cursor. Of course your db doesn't contain this colunm :-)

Substitute the lines

Stringurl= c.getString(c.getColumnIndex(c.getString(0)));
     Stringcode= c.getString(c.getColumnIndex(c.getString(1)));

with

Stringurl= c.getString(c.getColumnIndex("reco_index_user_action_download_file"));
     Stringcode= c.getString(c.getColumnIndex("reco_index_content_code"));

I also suggest to pull the code for getting the indices from within the loop to outside of the loop. No need to ask for the indices over and over again.

Post a Comment for "Java.lang.illegalstateexception: Couldn't Read Row 0, Col -1 From Cursorwindow - Android Sqlite Issue"