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 8727517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:26:53+00:00 2026-06-13T08:26:53+00:00

how do you close a cursor this error keeps showing everytime the database is

  • 0

how do you close a cursor this error keeps showing everytime the database is called

10-18 03:29:52.191: E/Cursor(426): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/standard.internet.marketing.mymovingfriend/databases/mymovingfriend, table = movingname, query = SELECT _id, movename, movedate FROM movingname WHERE movename= 'ok'
10-18 03:29:52.191: E/Cursor(426): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
10-18 03:29:52.191: E/Cursor(426):  at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
10-18 03:29:52.191: E/Cursor(426):  at standard.internet.marketing.mymovingfriend.SQLHandler.checkMove(SQLHandler.java:1094)
10-18 03:29:52.191: E/Cursor(426):  at standard.internet.marketing.mymovingfriend.ListMovingNames$3.onKey(ListMovingNames.java:98)
10-18 03:29:52.191: E/Cursor(426):  at android.view.View.dispatchKeyEvent(View.java:3735)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
10-18 03:29:52.191: E/Cursor(426):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1667)
10-18 03:29:52.191: E/Cursor(426):  at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1102)
10-18 03:29:52.191: E/Cursor(426):  at android.app.Activity.dispatchKeyEvent(Activity.java:2063)
10-18 03:29:52.191: E/Cursor(426):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1643)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
10-18 03:29:52.191: E/Cursor(426):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
10-18 03:29:52.191: E/Cursor(426):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 03:29:52.191: E/Cursor(426):  at android.os.Looper.loop(Looper.java:123)
10-18 03:29:52.191: E/Cursor(426):  at android.app.ActivityThread.main(ActivityThread.java:4627)
10-18 03:29:52.191: E/Cursor(426):  at java.lang.reflect.Method.invokeNative(Native Method)
10-18 03:29:52.191: E/Cursor(426):  at java.lang.reflect.Method.invoke(Method.java:521)
10-18 03:29:52.191: E/Cursor(426):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-18 03:29:52.191: E/Cursor(426):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-18 03:29:52.191: E/Cursor(426):  at dalvik.system.NativeStart.main(Native Method)

I tried doing this to close the cursor

public Cursor getMove(){
        String[] columns = new String[]{KEY_ID1, KEY_MOVENAME};
        Cursor cursor = ourDatabase.query(DATABASE_TABLE1, columns, null, null, null, null, null);
        cursor.close();
        return cursor;
    }

now the problem is that it says

10-18 03:47:53.921: E/AndroidRuntime(545): FATAL EXCEPTION: main
10-18 03:47:53.921: E/AndroidRuntime(545): java.lang.RuntimeException: Unable to start activity ComponentInfo{standard.internet.marketing.mymovingfriend/standard.internet.marketing.mymovingfriend.ListMovingNames}: java.lang.IllegalStateException: attempt to re-open an already-closed object: android.database.sqlite.SQLiteQuery (mSql = SELECT _id, movename FROM movingname) 
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.os.Looper.loop(Looper.java:123)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread.main(ActivityThread.java:4627)
10-18 03:47:53.921: E/AndroidRuntime(545):  at java.lang.reflect.Method.invokeNative(Native Method)
10-18 03:47:53.921: E/AndroidRuntime(545):  at java.lang.reflect.Method.invoke(Method.java:521)
10-18 03:47:53.921: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-18 03:47:53.921: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-18 03:47:53.921: E/AndroidRuntime(545):  at dalvik.system.NativeStart.main(Native Method)
10-18 03:47:53.921: E/AndroidRuntime(545): Caused by: java.lang.IllegalStateException: attempt to re-open an already-closed object: android.database.sqlite.SQLiteQuery (mSql = SELECT _id, movename FROM movingname) 
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:34)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:64)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:283)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:264)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.widget.CursorAdapter.getCount(CursorAdapter.java:132)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.widget.ListView.setAdapter(ListView.java:436)
10-18 03:47:53.921: E/AndroidRuntime(545):  at standard.internet.marketing.mymovingfriend.ListMovingNames.allFunctions(ListMovingNames.java:57)
10-18 03:47:53.921: E/AndroidRuntime(545):  at standard.internet.marketing.mymovingfriend.ListMovingNames.onCreate(ListMovingNames.java:36)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-18 03:47:53.921: E/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-18 03:47:53.921: E/AndroidRuntime(545):  ... 11 more

any solutions?

  • 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-06-13T08:26:54+00:00Added an answer on June 13, 2026 at 8:26 am

    This Line of code solves everything

      Cursor c = null;
                try {
                    .....
                    }
                } finally {
                    if(c != null){
                        c.close();
                    }       
                }
    
                return items;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm getting a Finalizing a Cursor that has not been deactivated or closed error
It seems that i cant fix this error msg. I close the cursor correctly..
I am having this annoying error that I could not solve.. here is my
I am getting this error in products search app that is not crashing but
I can't find what causing this error in my database, I posted some question
I have an app that functions properly and does not force close or crash.
I have this error with an sqlite-related cursor. i subclass SQLiteOpenHelper to get access
Where should I call close() on the code? The LogCat returns this error: close()
when I try to request informations from my sqlite database I get this error:
Whenever I close XCode, the User Info entries that I set for attributes in

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.