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

  • Home
  • SEARCH
  • 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 9228509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:20:32+00:00 2026-06-18T05:20:32+00:00

I am trying to fix a ‘finalize’ error that I have been battling with

  • 0

I am trying to fix a ‘finalize’ error that I have been battling with allday. This issue still persists after me trying a number of different database and cursor’.close()’ methods.

The code shown is how it stands now. It would be great if someone could guide me on closing my cursor and db’s in the correct manner, as at the moment if I close one, it seems to conflict with the other!

At the moment I am trying to set an ‘EditText’ with a retrieved string value from a object method set within the ‘onCreate’ method of a ‘AddAppointmentContact’ class that is called from the Intent of a dialog list.

Currently I am getting this error:

Error:

02-01 21:23:18.947: E/Cursor(274): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.example.flybase2/databases/persons_name, table = contactsTable, query = SELECT _id, persons_name, persons_telephone, persons_email, persons_comments FROM contactsTable WHER

I run similar code else where in my code and this works fine.

This is the code bundled with the ID of the name I have selected from a listview that holds the dialog:

else if (items[item].equals("Add Appointment")) {

Intent conAdd = new Intent("com.example.flybase2.AddAppointmentContact");
conAdd.putExtra("newpassedID", idToPass);
startActivity(conAdd);

And the ‘AddAppointmentContact’ class that is opened:

Bundle extras = getIntent().getExtras(); 
    sentID = extras.getLong("newPassedID"); 


    DBHandlerApp NameAppointPass = new DBHandlerApp(this, null, null);

    NameAppointPass.open();
    String nameReturned = NameAppointPass.getName(sentID);

    setName = (EditText) findViewById(R.id.inputAppName);
    setName.setText(nameReturned);

And the ‘.getName()’ method:

public String getName(long passedID) {

String [] columns = new String[]{KEY_ROWAPPID, KEY_NAMEAPP,   KEY_TYPEAPP, KEY_TIMEAPP, KEY_DATEAPP, KEY_COMMENTAPP};
        Cursor c = ourDatabase.query(DATABASE_TABLEAPP, columns, KEY_ROWAPPID + "=" + passedID, null, null, null, null);

        if(c != null && c.getCount() > 0)
        {
        c.moveToFirst();
        String name = c.getString(1);

        return name;
        }

        return null;
  • 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-18T05:20:33+00:00Added an answer on June 18, 2026 at 5:20 am

    Also agreeing that you must close your Cursor. Try this:

        if(c != null) {
            if(c.getCount() > 0 && c.moveToFirst())
            {
                String name = c.getString(1);
                c.close();
                return name;
            }
            c.close();
        }
        return null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to fix this issue for weeks but I'm at the
I've been trying to fix this error: {exception:Persistent class \Class org.myapp.model.Account does not seem
I've been trying to fix this error for about an hour now and I've
I have been trying to fix this for the last couple of days. I
I am trying to fix this issue for three days, but still no success.
I have been trying to fix this script for more than an hour and
I have been trying to fix this for a bit, and I must be
I have been trying to fix this for a while but I have had
Have been trying to fix this for the past hour. Here goes: <script type=text/javascript>
I have been trying to fix this on my site but I am having

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.