• Register
0 votes
453 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 334 views
334 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 24 views
0 votes
1 answer 31 views
31 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, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 16 views
16 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, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 516 views
516 views
Problem: I installed pygame in my system. After Instalation I wrote this code : import sys import settings import pygame def run_game(): pygame.init() all_settings = settings() screen = pygame.display.set_mode( (all_settings.screen_width, all_settings.screen_length)) pygame.display ... installed. ImportError: No module named 'pygame' Can anyone tell me what is the problem here and how to fix this?
asked Apr 26, 2020 samhaz 5k points
0 votes
2 answers 301 views
301 views
Problem : I am new to the Magento. When I try to install the Magento to Localhost it gives me below Error- One or more indexers are invalid. Make sure your Magento cron job is running. I have also tried the following to re index a Indexer php bin/magento indexer:reindex I did not find any help from above command. Why is above Error happening? How can I fix the above error?
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 22 views
0 votes
1 answer 78 views
78 views
Problem: I have very recently downloaded the Graphviz 2.38 MSI version then installed it under folder C:\Python34. Next step I ran pip install Graphviz everything went well. In my system's path I have also added C:\Python34\bin. When I tried to run my ... I also tried to uninstall my Graphviz and did pip uninstall graphviz then tried reinstalling it and pip install again still nothing is working.
asked Aug 28, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 141 views
141 views
Problem : Recently I was told to prepare the C# as I am in pool of new projects. So I have started learning C#. But because of some unknown reason to me now I am facing below error. “Make sure that the controller has a parameterless public constructor”. As I am very new to C# so I am unable to understand the above error. I need help from someone who can fix the above error.
asked Mar 31, 2020 morrisBson 3.2k points