• Register
0 votes

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

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.


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 236 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 21 views
Problem: Few days ago I was trying to get my data from MySQL PHP to the Android with the help of JSON Object but somehow it is not working for me. I was researching on my issue but the solution which I found online did not really help me. I am having the array ... but after working on it for so long I was still unsuccessful. Can someone who knows PHP and JSON try to help me in resolving my issue?
asked Aug 4 Raphael Pacheco 4.9k points
1 vote
1 answer 13 views
Problem: I want to know : How to pass data from one activity to another in android example . I have basic knowledge in android programming. I have one scenario where just after logging in through my login page then there will be the sign-out button on each of the ... my signed in user to the sign-out. Can someone guide me on how can I keep my session id available to all of the activities?
asked Jul 1 Raphael Pacheco 4.9k points