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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:22:28+00:00 2026-05-27T14:22:28+00:00

It seems that i cant fix this error msg. I close the cursor correctly..

  • 0

It seems that i cant fix this error msg.
I close the cursor correctly.. i tried even to create a new cursor with different reference name.. but this didnt work too.. what do i do wrong?

12-17 10:09:14.107: E/Cursor(277): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.lernapp.src/databases/LernApp, table = Answers, query = SELECT Answer, Correct FROM Answers WHERE TestId = ? AND TestPageId = ?

private void getRowData(LernAppOpenHelper myDbHelper) {
        String[] columnsTestPage = {"TestPageId", "Question","Picture"};
        Cursor cursor = myDbHelper.getQuery("TestPage", columnsTestPage, "TestId = ?", new String[]{testNummer}, null, null, null); 
        startManagingCursor(cursor);
        cursor.moveToFirst();

        while(!cursor.isAfterLast()){   
            int testPageId = cursor.getInt(cursor.getColumnIndex("TestPageId"));
            String question = cursor.getString(cursor.getColumnIndex("Question"));
            String picture = cursor.getString(cursor.getColumnIndex("Picture"));

            this.testPages.add(new TestPage(testPageId, question, picture));
            cursor.moveToNext();
        }
        cursor.close();
        columnsTestPage = null;

        String[] columnsAnswers = {"Answer", "Correct"};

        for(TestPage p: testPages){
            cursor = myDbHelper.getQuery("Answers", columnsAnswers, "TestId = ? AND TestPageId = ?", new String[]{testNummer, p.getTestPageId()}, null, null, null);
            cursor.moveToFirst();
            while(!cursor.isAfterLast()){
                String answer = cursor.getString(cursor.getColumnIndex("Answer"));
                int correct = cursor.getInt(cursor.getColumnIndex("Correct"));
                p.setAnswer(answer, correct);
                cursor.moveToNext();
            }           
        }   

        cursor.close();
    }
  • 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-27T14:22:29+00:00Added an answer on May 27, 2026 at 2:22 pm

    if you use startManagingCursor(cursor); there’s no need to close the cursor, Android will do it for you.
    Either remove startManagingCursor(cursor);, or remove cursor.close(); references.

    EDIT:
    Try this:

    private void getRowData(LernAppOpenHelper myDbHelper) {
            String[] columnsTestPage = {"TestPageId", "Question","Picture"};
            Cursor cursor = myDbHelper.getQuery("TestPage", columnsTestPage, "TestId = ?", new String[]{testNummer}, null, null, null);
    
            cursor.moveToFirst();
            while(!cursor.isAfterLast()){   
                int testPageId = cursor.getInt(cursor.getColumnIndex("TestPageId"));
                String question = cursor.getString(cursor.getColumnIndex("Question"));
                String picture = cursor.getString(cursor.getColumnIndex("Picture"));
    
                this.testPages.add(new TestPage(testPageId, question, picture));
                cursor.moveToNext();
            }
            cursor.close();
            columnsTestPage = null;
    
            String[] columnsAnswers = {"Answer", "Correct"};
    
            for(TestPage p: testPages){
                cursor = myDbHelper.getQuery("Answers", columnsAnswers, "TestId = ? AND TestPageId = ?", new String[]{testNummer, p.getTestPageId()}, null, null, null);
                cursor.moveToFirst();
                while(!cursor.isAfterLast()){
                    String answer = cursor.getString(cursor.getColumnIndex("Answer"));
                    int correct = cursor.getInt(cursor.getColumnIndex("Correct"));
                    p.setAnswer(answer, correct);
                    cursor.moveToNext();
                }
                cursor.close(); // Close the cursor here before the next loop
            }   
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with MATLAB that i cant quite fix. It is throwing
It seems that I can't control the NSApp delegate from within a System Preferences
I'm trying to consume a webmethod but it seems that my application can't resolve
I can't believe that the following statement seems to be still true So, I
We have an error that we can't seem to find and don't have the
I get this problem in IE7 when running a piece of code that uses
I have a problem that seems very related to that in another post, but
I keep getting this issue with PDO, where this error crops up in my
I have found this script and cant seem to figure out why it throws
We've been seeing this error crop up in our system event logs an alarming

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.