Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6223355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:28:31+00:00 2026-05-24T08:28:31+00:00

I have an activity that populates a list and does some other things from

  • 0

I have an activity that populates a list and does some other things from a cursor. I get the cursor from a method that returns it based on a standard android SQLite query to my database. The method is defined in my SQLHelper class. The method opens the database, queries, closed the database, and returns the cursor. After the cursor has been collected in the activity, I call startManagingCursor(cursor);

All that works fine.

The problem happens when I launch a sub activity and then come back to the first one. I get a force close with the following output:

07-28 18:11:04.674: ERROR/AndroidRuntime(224): java.lang.RuntimeException: Unable to resume activity {blabla}: java.lang.IllegalStateException: mQuery SELECT * FROM vehicles WHERE _id=? 1 
...
07-28 18:11:04.674: ERROR/AndroidRuntime(224): Caused by: java.lang.IllegalStateException: mQuery SELECT * FROM vehicles WHERE _id=? 1 
07-28 18:11:04.674: ERROR/AndroidRuntime(224):     at android.database.sqlite.SQLiteQuery.requery(SQLiteQuery.java:162)
07-28 18:11:04.674: ERROR/AndroidRuntime(224):     at android.database.sqlite.SQLiteCursor.requery(SQLiteCursor.java:536)

...
07-28 18:11:04.674: ERROR/AndroidRuntime(224): Caused by: android.database.sqlite.SQLiteMisuseException: library routine called out of sequence: handle 0x0
07-28 18:11:04.674: ERROR/AndroidRuntime(224):     at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method)
07-28 18:11:04.674: ERROR/AndroidRuntime(224):     at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:178)
07-28 18:11:04.674: ERROR/AndroidRuntime(224):     at android.database.sqlite.SQLiteQuery.requery(SQLiteQuery.java:153)

The problem is apparently when it is trying to re-query the cursor. If I close the cursor manually before I launch the intent, then it works fine. But then I need to re-query it manually and isn’t that the entire point of startManagingCursor()? I have two cursors in the activity that are both created in the same way and I call start managing cursor on both, both cause a crash on resume.

Is there something else I need to do to get my activity to properly manage my cursors?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:28:32+00:00Added an answer on May 24, 2026 at 8:28 am

    Well, it turns out that Cursor.requery() is depreciated and I was getting the same error every time I tried to call it. startManagingCursor() was calling requery, as I suppose it should, and that in turn was causing my problems there… I’m not sure why requery is causing an error in this instance, I’ve used it successfully before.

    I ended up rearranging some code, and putting my cursor = SQLHelper.getwhatevercursor() code into onResume() instead of onCreate, as onResume is called right after onCreate anyway. As recommended by Nikola I am also closing the cursors in onPause().

    This seems to be working now…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-based application that notifies users of activity on the site via
I have an activity that extends ListView. I populate my list with the results
I've populated a ListActivity from a Cursor using SimpleCursorAdapter that starts another activity when
I have an activity that extends ViewFactory. The activity does nothing more than act
I have an activity that has a TabHost containing a set of TabSpecs each
i have created a workflow activity that do give the item creater of a
I have Activity with ListView inside it and in the onCreate method of the
I have an activity that has properties that look something like this (they're set
I have an Activity and Service that work together in my application. I've configured
I have a script that appends some rows to a table. One of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.