tags:

views:

232

answers:

1

I get the below error message in android.

Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.example.Recipie/databases/recipedbase.db, table = recipes, query = SELECT DISTINCT title FROM recipes WHERE title="Mysore Pa" android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here at android.database.sqlite.SQLiteCursor.(SQLiteCursor.java:210)

I have added this in my code. But Also i get the above message. Kindly help. :)

@Override
    protected void onDestroy()
    {
        super.onDestroy();
        rDbHelper.close();
    }
+3  A: 

You must close your cursors.

fedj
Should I close it in the same onDestroy() function?
Santosh V M
You should take a look to startManagingCursor and stopManagingCursor at this link : http://developer.android.com/reference/android/app/Activity.html#startManagingCursor(android.database.Cursor)
fedj