• Register
0 votes
634 views

Problem :

I am trying to get the data from my DB.

My code fails on below line:

list[p] = cImage.getString(i);

The error message is as below:

11-27 12:34:59.683: E/CursorWindow(6901): Failed to read row 2, column 0 from a CursorWindow which has 2 rows, 2 columns.
11-27 12:34:59.683: D/AndroidRuntime(6901): Shutting down VM
11-27 12:34:59.683: W/dalvikvm(6901): threadid=1: thread exiting with uncaught exception (group=0x41e9b930)
11-27 12:34:59.693: E/AndroidRuntime(6901): FATAL EXCEPTION: main
11-27 12:34:59.693: E/AndroidRuntime(6901): java.lang.RuntimeException: Unable to create service com.example.imageswidget.WidgetService: java.lang.IllegalStateException: Couldn't read row 2, col 0 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
11-27 12:34:59.693: E/AndroidRuntime(6901):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2667)

For my call log:

Log.i("image length", list[p].length()+"");

I get few calls before my code breaks. The problem seems to happen only for some of the rows but a error code does not tell me what a problem is

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

In my case the error was because I didn't include a column in a projection passed into a CursorLoader constructor. Which means I was trying to access the data from the column that didn't exist in my cursor that was returned.

It worked for me.

OR

Try calling the cursor.moveToFirst () before using a cursor. Let me know if that worked.

9 7 4
38,600 points

Related questions

0 votes
1 answer 433 views
433 views
Problem : When I try to run previously working git commands I am facing following error: unable to locate xcodebuild, please make sure the path to the xcode folder is set correctly!
asked Nov 16, 2019 peterlaw 6.9k points
0 votes
1 answer 6 views
6 views
Problem: i have a problem that i am unable to list target platforms. please make sure the android sdk path is correct unity.
asked Mar 22 waseem memon 2.4k points
0 votes
1 answer 36 views
36 views
Problem: I have an issue that i am unable to launch game make sure the target and startin folder point to correct path and folder.
asked Mar 22 waseem memon 2.4k points
0 votes
1 answer 51 views
51 views
Problem: make sure to call firebaseapp.initializeapp(context) first.
asked Feb 17 Dan phillip 4.1k points
0 votes
1 answer 3 views
3 views
Can someone help me with the error message I am getting tat is in valid status 6a80. Check to make sure contract data is on?
asked Apr 4 Sana8989 7.7k points
0 votes
1 answer 2 views
2 views
Problem: i don’t understand about this problem please help? google pay trouble accessing your contacts account
asked Apr 1 Rohit kr 14.7k points
0 votes
1 answer 3 views
3 views
Problem Someone tell me about the method which is called before the oncreateview method in fragment's lifecycle.
asked 3 days ago salim1 30.7k points
0 votes
1 answer 20 views
20 views
Problem: the ad size and ad unit id must be set before loadad is called.
asked Feb 21 charles mathews 5.5k points
0 votes
1 answer 41 views